summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2025-10-10 16:39:24 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2025-10-10 18:16:10 +0200
commit2319912a3ee1fd646063f70c4a499d526e34137c (patch)
tree3f7337d58af7a0f1ef1567cc6627463081dd0d38
parentdfb01006d4e7306bc01849c50edfe54abfd83610 (diff)
downloadIshtar-2319912a3ee1fd646063f70c4a499d526e34137c.tar.bz2
Ishtar-2319912a3ee1fd646063f70c4a499d526e34137c.zip
⚡️ template containers: improve performance
-rw-r--r--archaeological_warehouse/models.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/archaeological_warehouse/models.py b/archaeological_warehouse/models.py
index af55fd74b..f6296f5e1 100644
--- a/archaeological_warehouse/models.py
+++ b/archaeological_warehouse/models.py
@@ -1951,8 +1951,12 @@ class Container(
if not filtr or cr_in_filter:
kwargs["exclude"] = base_exclude[:] + [prefix + "operation"]
kwargs["force_no_base_finds"] = True
+ cr_prefix = "context_record_"
+ new_filtr = [
+ k[len(cr_prefix):] for k in filtr if k.startswith(cr_prefix)
+ ]
for k, v in cr.get_values(
- prefix=prefix, no_values=True, filtr=None, **kwargs
+ prefix=prefix, no_values=True, filtr=new_filtr, **kwargs
).items():
values[prefix + "context_record_" + k] = v
if not filtr or operation_in_filter:
@@ -1961,8 +1965,12 @@ class Container(
f"{prefix}document_containers",
f"{prefix}all_containers"
]
+ op_prefix = "operation_"
+ new_filtr = [
+ k[len(op_prefix):] for k in filtr if k.startswith(op_prefix)
+ ]
for k, v in cr.operation.get_values(
- prefix=prefix, no_values=True, filtr=None, **kwargs
+ prefix=prefix, no_values=True, filtr=new_filtr, **kwargs
).items():
values[prefix + "operation_" + k] = v
return values