mirror of
				https://gitlab.com/animath/si/plateforme.git
				synced 2025-11-04 05:02:14 +01:00 
			
		
		
		
	Fix import
This commit is contained in:
		@@ -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"))
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user