diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-11-26 20:15:07 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-11-26 20:15:07 +0100 |
commit | a6f67644de25c8ef285785c32ad2102de9d5d142 (patch) | |
tree | 2f43ff8405a14088128817969d4512fd7e48ff42 | |
parent | bf5298f8cd845b2c97a9114d9f5951534ab2104e (diff) | |
download | Ishtar-a6f67644de25c8ef285785c32ad2102de9d5d142.tar.bz2 Ishtar-a6f67644de25c8ef285785c32ad2102de9d5d142.zip |
Operation / sites: attach query owns to item linked with warehouse
-rw-r--r-- | archaeological_operations/models.py | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py index ae9c221c4..919b1ba15 100644 --- a/archaeological_operations/models.py +++ b/archaeological_operations/models.py @@ -281,8 +281,23 @@ class ArchaeologicalSite(BaseHistorizedItem, OwnPerms, ValueGetter, @classmethod def get_query_owns(cls, ishtaruser): + from archaeological_warehouse.models import Warehouse q = cls._construct_query_own( + 'operations__context_record__base_finds__find__container__responsible__', + Warehouse._get_query_owns_dicts(ishtaruser) + ) | cls._construct_query_own( + 'operations__context_record__base_finds__find__container__location__', + Warehouse._get_query_owns_dicts(ishtaruser) + ) | cls._construct_query_own( + 'top_operation__context_record__base_finds__find__container__responsible__', + Warehouse._get_query_owns_dicts(ishtaruser) + ) | cls._construct_query_own( + 'top_operation__context_record__base_finds__find__container__location__', + Warehouse._get_query_owns_dicts(ishtaruser) + ) | cls._construct_query_own( 'operations__', Operation._get_query_owns_dicts(ishtaruser) + ) | cls._construct_query_own( + 'top_operation__', Operation._get_query_owns_dicts(ishtaruser) ) | cls._construct_query_own('', [ {'history_creator': ishtaruser.user_ptr}, ]) @@ -1099,9 +1114,17 @@ class Operation(ClosedItem, BaseHistorizedItem, OwnPerms, ValueGetter, @classmethod def get_query_owns(cls, ishtaruser): - return cls._construct_query_own( + from archaeological_warehouse.models import Warehouse + q = cls._construct_query_own( + 'context_record__base_finds__find__container__responsible__', + Warehouse._get_query_owns_dicts(ishtaruser) + ) | cls._construct_query_own( + 'context_record__base_finds__find__container__location__', + Warehouse._get_query_owns_dicts(ishtaruser) + ) | cls._construct_query_own( '', cls._get_query_owns_dicts(ishtaruser) ) + return q def is_active(self): return not bool(self.end_date) |