summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--archaeological_operations/models.py25
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)