1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2024-12-25 17:42:24 +00:00

Fix import

This commit is contained in:
Yohann D'ANELLO 2020-05-05 07:23:07 +02:00
parent e04e432292
commit bff49889c5

View File

@ -164,7 +164,6 @@ class Command(BaseCommand):
"is_staff": args[18] == "ADMIN", "is_staff": args[18] == "ADMIN",
"is_superuser": args[18] == "ADMIN", "is_superuser": args[18] == "ADMIN",
} }
print(obj_dict)
with transaction.atomic(): with transaction.atomic():
TFJMUser.objects.create(**obj_dict) TFJMUser.objects.create(**obj_dict)
self.stdout.write(self.style.SUCCESS("Users imported")) self.stdout.write(self.style.SUCCESS("Users imported"))
@ -250,7 +249,6 @@ class Command(BaseCommand):
Solution.objects.create(**obj_dict) Solution.objects.create(**obj_dict)
except: except:
print("Solution exists") print("Solution exists")
continue
self.stdout.write(self.style.SUCCESS("Solutions imported")) self.stdout.write(self.style.SUCCESS("Solutions imported"))
with open("import_olddb/syntheses.csv") as f: with open("import_olddb/syntheses.csv") as f:
@ -274,5 +272,8 @@ class Command(BaseCommand):
"uploaded_at": args[4], "uploaded_at": args[4],
} }
with transaction.atomic(): with transaction.atomic():
try:
Synthesis.objects.create(**obj_dict) Synthesis.objects.create(**obj_dict)
except:
print("Synthesis exists")
self.stdout.write(self.style.SUCCESS("Syntheses imported")) self.stdout.write(self.style.SUCCESS("Syntheses imported"))