diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2024-09-16 12:43:18 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2024-09-16 12:43:18 +0200 |
commit | db5ecbb7b69ff668ca005bd9535bf595b79e649e (patch) | |
tree | da2573ab67a830346bcbd17d448bd8bb106ba4e0 /archaeological_context_records | |
parent | 296ee1376450adf58a040a9da816a100fa5d2ec9 (diff) | |
download | Ishtar-db5ecbb7b69ff668ca005bd9535bf595b79e649e.tar.bz2 Ishtar-db5ecbb7b69ff668ca005bd9535bf595b79e649e.zip |
⚡️ improve performance - do not reevalute ContextRecordTree if not necessary
Diffstat (limited to 'archaeological_context_records')
-rw-r--r-- | archaeological_context_records/models.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/archaeological_context_records/models.py b/archaeological_context_records/models.py index 0ac13e43a..ee43183eb 100644 --- a/archaeological_context_records/models.py +++ b/archaeological_context_records/models.py @@ -1286,7 +1286,8 @@ def context_record_post_save(sender, **kwargs): instance = kwargs.get("instance", None) if not instance or not instance.pk: return - ContextRecordTree.update(instance.pk) + if kwargs.get("created", False): # on creation: manage self relation + ContextRecordTree.update(instance.pk) BaseFind = apps.get_model("archaeological_finds", "BaseFind") Find = apps.get_model("archaeological_finds", "Find") for bf in instance.base_finds.all(): |