From b0c2ded8e95dcf61b36685fec4b40d9bcf82bef0 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Wed, 19 Mar 2025 11:54:38 +0100 Subject: 🚑️ fix huge performance problems on permissions when too many items are attached MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- archaeological_finds/models_finds.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'archaeological_finds') diff --git a/archaeological_finds/models_finds.py b/archaeological_finds/models_finds.py index f140c2d61..fa38a6dbb 100644 --- a/archaeological_finds/models_finds.py +++ b/archaeological_finds/models_finds.py @@ -3078,20 +3078,25 @@ class Find( def _get_query_owns(cls, ishtaruser, prefix=""): q = ( cls._construct_query_own( - f"{prefix}container__location__", Warehouse._get_query_owns_dicts(ishtaruser) + cls, f"{prefix}container__location__", + Warehouse._get_query_owns_dicts(ishtaruser) ) | cls._construct_query_own( - f"{prefix}container__responsible__", Warehouse._get_query_owns_dicts(ishtaruser) + cls, f"{prefix}container__responsible__", + Warehouse._get_query_owns_dicts(ishtaruser) ) | cls._construct_query_own( + cls, f"{prefix}base_finds__context_record__operation__", Operation._get_query_owns_dicts(ishtaruser), ) | cls._construct_query_own( + cls, f"{prefix}basket__", [{"shared_with": ishtaruser, "shared_write_with": ishtaruser}], ) | cls._construct_query_own( + cls, "", [ {f"{prefix}history_creator": ishtaruser.user_ptr}, -- cgit v1.2.3