diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2025-06-26 20:45:11 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2025-06-26 20:45:11 +0200 |
commit | 737587eda4391494b1c44caa5e21ad7c2ff9ef50 (patch) | |
tree | 5736c3f16c12f007e7961b88561d2364368b2276 /archaeological_warehouse/models.py | |
parent | aab08f0337002bb90a002e22153f9fd68e1dd61d (diff) | |
download | Ishtar-737587eda4391494b1c44caa5e21ad7c2ff9ef50.tar.bz2 Ishtar-737587eda4391494b1c44caa5e21ad7c2ff9ef50.zip |
⚡️ imports: performance optimisations
Diffstat (limited to 'archaeological_warehouse/models.py')
-rw-r--r-- | archaeological_warehouse/models.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/archaeological_warehouse/models.py b/archaeological_warehouse/models.py index 9700e689a..9a253e735 100644 --- a/archaeological_warehouse/models.py +++ b/archaeological_warehouse/models.py @@ -1693,8 +1693,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 @@ -1966,12 +1970,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): |