From ddfc170a3c084f97df3ce5b9d38576138852578e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Herv=C3=A9=20=20MENAGER?= <herve.menager@pasteur.fr>
Date: Sun, 26 Mar 2017 23:51:32 +0200
Subject: [PATCH] reset MolecularFunction database before Protein import

---
 ippisite/ippidb/management/commands/import_v1_data.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/ippisite/ippidb/management/commands/import_v1_data.py b/ippisite/ippidb/management/commands/import_v1_data.py
index 8820aca4..5d6592cc 100644
--- a/ippisite/ippidb/management/commands/import_v1_data.py
+++ b/ippisite/ippidb/management/commands/import_v1_data.py
@@ -1,7 +1,7 @@
 from django.core.management import BaseCommand, CommandError
 import mysql.connector
 
-from ippidb.models import Bibliography, Protein, Taxonomy
+from ippidb.models import Bibliography, Protein, Taxonomy, MolecularFunction
 
 class Command(BaseCommand):
 
@@ -59,6 +59,8 @@ class Command(BaseCommand):
             self.stdout.write(self.style.SUCCESS('Successfully flushed protein table'))
             Taxonomy.objects.all().delete()
             self.stdout.write(self.style.SUCCESS('Successfully flushed taxonomy table'))
+            MolecularFunction.objects.all().delete()
+            self.stdout.write(self.style.SUCCESS('Successfully flushed molecular function table'))
             for row in rows:
                 try:
                     p = Protein()
-- 
GitLab