summaryrefslogtreecommitdiff
path: root/archaeological_warehouse/models.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2025-06-26 20:45:11 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2025-06-27 10:59:30 +0200
commit66f6d4951bc7cd801757feca3b4a403ebedb2d64 (patch)
tree09ffe42906a9a6492a102efd0240aaaf93bd8943 /archaeological_warehouse/models.py
parent42b0ad69ed32fb72787e3bcdd0400ec7e2eb9156 (diff)
downloadIshtar-66f6d4951bc7cd801757feca3b4a403ebedb2d64.tar.bz2
Ishtar-66f6d4951bc7cd801757feca3b4a403ebedb2d64.zip
⚡️ imports: performance optimisations
Diffstat (limited to 'archaeological_warehouse/models.py')
-rw-r--r--archaeological_warehouse/models.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/archaeological_warehouse/models.py b/archaeological_warehouse/models.py
index 2c6feaffc..d692f3dd9 100644
--- a/archaeological_warehouse/models.py
+++ b/archaeological_warehouse/models.py
@@ -1717,8 +1717,12 @@ class Container(
return None, error_msg
return
current_localisation = Container.objects.create(**dct)
+ current_localisation_id = current_localisation.id
+ # do not use save is query friendly
+ self.__class__.objects.filter(pk=self.id).update(
+ parent_id=current_localisation_id)
+ # update the cached value of the parent - safer for post-treatments
self.parent = current_localisation
- self.save()
if return_errors:
return current_localisation, None
return current_localisation
@@ -1990,12 +1994,12 @@ class Container(
for find in self.finds.all():
updated = find.update_current_full_location(full_location)
if updated:
- find.skip_history_when_saving = True
+ find.no_post_process()
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.no_post_process()
find.save()
def pre_save(self):