From a91c54dbb338a075a2dbf2e9ddc2d4acff225f2e Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Wed, 23 Dec 2020 08:48:56 +0100 Subject: Container: fix index generation --- .../management/commands/migrate_to_new_container_management.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'archaeological_warehouse/management') diff --git a/archaeological_warehouse/management/commands/migrate_to_new_container_management.py b/archaeological_warehouse/management/commands/migrate_to_new_container_management.py index 44895ce69..24ec078bf 100644 --- a/archaeological_warehouse/management/commands/migrate_to_new_container_management.py +++ b/archaeological_warehouse/management/commands/migrate_to_new_container_management.py @@ -58,7 +58,10 @@ class Command(BaseCommand): for idx, container in enumerate(to_update.values("id").all()): sys.stdout.write("* Updating: {}/{}\r".format(idx + 1, to_be_done)) sys.stdout.flush() - container = models.Container.objects.get(pk=container["id"]) + try: + container = models.Container.objects.get(pk=container["id"]) + except models.Container.DoesNotExist: + continue # already merged if container.responsible_id not in potential_duplicate: potential_duplicate[container.responsible_id] = {} parent = None -- cgit v1.2.3