summaryrefslogtreecommitdiff
path: root/archaeological_warehouse/models.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2021-01-21 17:50:51 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2021-02-28 12:15:23 +0100
commit9ec4e271f9285fb7cd8d735c859decaa9c0d2673 (patch)
treee86de03a208f0583ed57159e4fe12ecf264efea4 /archaeological_warehouse/models.py
parent311a4addb62dc4dac5a6fee7c2097a118acb9a8e (diff)
downloadIshtar-9ec4e271f9285fb7cd8d735c859decaa9c0d2673.tar.bz2
Ishtar-9ec4e271f9285fb7cd8d735c859decaa9c0d2673.zip
Fix migration of new containers - add collection field
Diffstat (limited to 'archaeological_warehouse/models.py')
-rw-r--r--archaeological_warehouse/models.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/archaeological_warehouse/models.py b/archaeological_warehouse/models.py
index 8273619d9..5d06cefda 100644
--- a/archaeological_warehouse/models.py
+++ b/archaeological_warehouse/models.py
@@ -1357,6 +1357,11 @@ class Container(DocumentItem, Merge, LightHistorizedItem,
return actions
def pre_save(self):
+ if not self.collection_id and not self.collection:
+ if self.location_id:
+ self.collection_id = self.location_id
+ else:
+ self.collection = self.location
q = Container.objects.filter(index=self.index, location=self.location)
if self.id:
q = q.exclude(id=self.id)