From bff49889c503096c9fe16b9f0b7fbbbc4195a637 Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Tue, 5 May 2020 07:23:07 +0200 Subject: [PATCH] Fix import --- apps/member/management/commands/import_olddb.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/apps/member/management/commands/import_olddb.py b/apps/member/management/commands/import_olddb.py index 7a5d439..52e9f51 100644 --- a/apps/member/management/commands/import_olddb.py +++ b/apps/member/management/commands/import_olddb.py @@ -164,7 +164,6 @@ class Command(BaseCommand): "is_staff": args[18] == "ADMIN", "is_superuser": args[18] == "ADMIN", } - print(obj_dict) with transaction.atomic(): TFJMUser.objects.create(**obj_dict) self.stdout.write(self.style.SUCCESS("Users imported")) @@ -250,7 +249,6 @@ class Command(BaseCommand): Solution.objects.create(**obj_dict) except: print("Solution exists") - continue self.stdout.write(self.style.SUCCESS("Solutions imported")) with open("import_olddb/syntheses.csv") as f: @@ -274,5 +272,8 @@ class Command(BaseCommand): "uploaded_at": args[4], } with transaction.atomic(): - Synthesis.objects.create(**obj_dict) + try: + Synthesis.objects.create(**obj_dict) + except: + print("Synthesis exists") self.stdout.write(self.style.SUCCESS("Syntheses imported"))