diff options
| author | Étienne Loks <etienne.loks@iggdrasil.net> | 2025-10-10 16:39:24 +0200 |
|---|---|---|
| committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2025-10-21 17:15:03 +0200 |
| commit | 0c5bbdf2081b072646e51b0976e78b2d1e5f4bfa (patch) | |
| tree | 5f46aa66412470a1d8a17a973254cbcef8f6edfc | |
| parent | 020c3a72963860e6cfaa8e8129dcd41ef05e7413 (diff) | |
| download | Ishtar-0c5bbdf2081b072646e51b0976e78b2d1e5f4bfa.tar.bz2 Ishtar-0c5bbdf2081b072646e51b0976e78b2d1e5f4bfa.zip | |
⚡️ template containers: improve performance
| -rw-r--r-- | archaeological_warehouse/models.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/archaeological_warehouse/models.py b/archaeological_warehouse/models.py index 9a253e735..8c9a94f06 100644 --- a/archaeological_warehouse/models.py +++ b/archaeological_warehouse/models.py @@ -1927,8 +1927,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: @@ -1937,8 +1941,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 |
