From 8d7ed2a8208a1d3422e4827a35fa7d6cb7f59cee Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Thu, 21 Jan 2021 17:50:51 +0100 Subject: Fix migration of new containers - add collection field --- .../management/commands/migrate_to_new_container_management.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (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 24ec078bf..38cabd842 100644 --- a/archaeological_warehouse/management/commands/migrate_to_new_container_management.py +++ b/archaeological_warehouse/management/commands/migrate_to_new_container_management.py @@ -76,8 +76,8 @@ class Command(BaseCommand): parent=parent, container_type=container_types[ division.division.division_id], - location=container.responsible, - responsible=container.responsible) + location=container.location, + responsible=container.location) if created: created_nb += 1 ref = "{} || {}".format(str(new_container.container_type), @@ -89,6 +89,9 @@ class Command(BaseCommand): potential_duplicate[container.responsible_id][ ref].append(division.reference.strip()) parent = new_container + if container.collection_id != container.responsible_id: + container.collection_id = container.responsible_id + container.save() if parent: q = models.Container.objects.filter( location=container.location, -- cgit v1.2.3