summaryrefslogtreecommitdiff
path: root/archaeological_warehouse/models.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2024-09-09 14:45:17 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2024-09-10 15:40:21 +0200
commit66232651ef2a2c1f331dc381a8f86f24a279ba85 (patch)
treee4c43e6209a35d84f3b1b362237570224f511fd5 /archaeological_warehouse/models.py
parent39daa533e0b9d2a942223eeca817cdaa8887d69b (diff)
downloadIshtar-66232651ef2a2c1f331dc381a8f86f24a279ba85.tar.bz2
Ishtar-66232651ef2a2c1f331dc381a8f86f24a279ba85.zip
✨ find container history: manage first packaging info
Diffstat (limited to 'archaeological_warehouse/models.py')
-rw-r--r--archaeological_warehouse/models.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/archaeological_warehouse/models.py b/archaeological_warehouse/models.py
index d501eab1f..8bcc2bd65 100644
--- a/archaeological_warehouse/models.py
+++ b/archaeological_warehouse/models.py
@@ -1946,6 +1946,21 @@ class Container(
]
return actions
+ def update_find_location(self):
+ full_location = self.generate_full_location()
+ if not full_location:
+ return
+ for find in self.finds.all():
+ updated = find.update_current_full_location(full_location)
+ if updated:
+ find.skip_history_when_saving = True
+ find.save()
+ for find in self.finds_ref.all():
+ updated = find.update_ref_full_location(full_location)
+ if updated:
+ find.skip_history_when_saving = True
+ find.save()
+
def pre_save(self):
if self.parent == self:
self.parent = None
@@ -1992,6 +2007,7 @@ class Container(
logger.debug(f"[ishtar] archaeological_warehouse.models.Container.save - {self.pk} - {self.cached_label}")
self.pre_save()
super().save(*args, **kwargs)
+ self.update_find_location()
self._change_child_location(self)
updated = False
updated += self._prevent_parent_infinite_loop()