Fix import

This commit is contained in:
Yohann D'ANELLO 2020-05-05 07:23:07 +02:00
parent e04e432292
commit bff49889c5
1 changed files with 4 additions and 3 deletions

View File

@ -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"))