diff --git a/apps/member/management/commands/import_olddb.py b/apps/member/management/commands/import_olddb.py index 409af17..eac1125 100644 --- a/apps/member/management/commands/import_olddb.py +++ b/apps/member/management/commands/import_olddb.py @@ -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: