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

Fix import

This commit is contained in:
Yohann D'ANELLO 2020-05-05 07:09:17 +02:00
parent 1e574208bd
commit 240b0472a0

View File

@ -151,7 +151,7 @@ class Command(BaseCommand):
"country": args[10],
"phone_number": args[11],
"school": args[12],
"student_class": args[13].lower().replace('premiere', 'première'),
"student_class": args[13].lower().replace('premiere', 'première') if args[13] else None,
"responsible_name": args[14],
"responsible_phone": args[15],
"responsible_email": args[16],
@ -245,7 +245,11 @@ class Command(BaseCommand):
"uploaded_at": args[4],
}
with transaction.atomic():
Solution.objects.create(**obj_dict)
try:
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: