Skip to content
Snippets Groups Projects
Commit 7a90f0c2 authored by Hervé  MENAGER's avatar Hervé MENAGER
Browse files

correct AutoFillableModel save() method

Former-commit-id: 12c1287962b7745bd096b3988ea9d663cdb6e050
parent 63675775
No related branches found
No related tags found
No related merge requests found
......@@ -18,7 +18,9 @@ class AutoFillableModel(models.Model):
def save(self, *args, **kwargs):
if kwargs.get('autofill') is True:
self.autofill()
super(AutoFillableModel, self).save(*args, **kwargs)
if 'autofill' in kwargs:
del kwargs['autofill']
super(AutoFillableModel, self).save(*args, *kwargs)
class Bibliography(AutoFillableModel):
......@@ -30,7 +32,7 @@ class Bibliography(AutoFillableModel):
('PT', 'Patent'),
('DO', 'DOI ID')
)
source = models.CharField('Bibliographic type', max_length=2, choices=SOURCES)
source = models.CharField('Bibliographic type', max_length=2, choices=SOURCES, default='PM')
id_source = models.CharField('Bibliographic ID', max_length=25)
title = models.CharField('Title', max_length=300)
journal_name = models.CharField('Journal name', max_length=50, null=True)
......@@ -107,7 +109,8 @@ class Protein(AutoFillableModel):
taxonomy.taxonomy_id = info['organism']
taxonomy.save(autofill=True)
self.organism = taxonomy
#super(Protein, self).save(*args, **kwargs)
print(self, self.gene_name)
super(Protein, self).save()
for go_id in info['molecular_functions']:
try:
mol_function = MolecularFunction.objects.get(go_id=go_id)
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment