Fix import
This commit is contained in:
parent
1e574208bd
commit
240b0472a0
|
@ -151,7 +151,7 @@ class Command(BaseCommand):
|
||||||
"country": args[10],
|
"country": args[10],
|
||||||
"phone_number": args[11],
|
"phone_number": args[11],
|
||||||
"school": args[12],
|
"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_name": args[14],
|
||||||
"responsible_phone": args[15],
|
"responsible_phone": args[15],
|
||||||
"responsible_email": args[16],
|
"responsible_email": args[16],
|
||||||
|
@ -245,7 +245,11 @@ class Command(BaseCommand):
|
||||||
"uploaded_at": args[4],
|
"uploaded_at": args[4],
|
||||||
}
|
}
|
||||||
with transaction.atomic():
|
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"))
|
self.stdout.write(self.style.SUCCESS("Solutions imported"))
|
||||||
|
|
||||||
with open("import_olddb/syntheses.csv") as f:
|
with open("import_olddb/syntheses.csv") as f:
|
||||||
|
|
Loading…
Reference in New Issue