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
commit8d7ed2a8208a1d3422e4827a35fa7d6cb7f59cee (patch)
treee86de03a208f0583ed57159e4fe12ecf264efea4 /archaeological_warehouse/models.py
parente4782f904c34e78e551093010d062e19a92d4833 (diff)
downloadIshtar-8d7ed2a8208a1d3422e4827a35fa7d6cb7f59cee.tar.bz2
Ishtar-8d7ed2a8208a1d3422e4827a35fa7d6cb7f59cee.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)