From 7a90f0c2fc7e15f5a40df307369f6b746bc84a76 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Herv=C3=A9=20=20MENAGER?= <herve.menager@pasteur.fr>
Date: Fri, 16 Jun 2017 10:23:13 +0200
Subject: [PATCH] correct AutoFillableModel save() method

Former-commit-id: 12c1287962b7745bd096b3988ea9d663cdb6e050
---
 ippisite/ippidb/models.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/ippisite/ippidb/models.py b/ippisite/ippidb/models.py
index d2d8ddfc..1a683e63 100644
--- a/ippisite/ippidb/models.py
+++ b/ippisite/ippidb/models.py
@@ -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)
-- 
GitLab