diff options
Diffstat (limited to 'archaeological_warehouse/models.py')
-rw-r--r-- | archaeological_warehouse/models.py | 5 |
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) |