Only delete the ContentTypes and Permissions once, not the loop

This commit is contained in:
Trenton H 2023-11-17 11:25:07 -08:00
parent ed34815393
commit 11ed59dc29

View File

@ -118,10 +118,10 @@ class Command(BaseCommand):
# Fill up the database with whatever is in the manifest
try:
with transaction.atomic():
# delete these since pk can change, re-created from import
ContentType.objects.all().delete()
Permission.objects.all().delete()
for manifest_path in manifest_paths:
# delete these since pk can change, re-created from import
ContentType.objects.all().delete()
Permission.objects.all().delete()
call_command("loaddata", manifest_path)
except (FieldDoesNotExist, DeserializationError, IntegrityError) as e:
self.stdout.write(self.style.ERROR("Database import failed"))