summaryrefslogtreecommitdiff
path: root/archaeological_operations/models.py
diff options
context:
space:
mode:
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
commit00eb1c670aac77cef068e656dcb0bb192c656936 (patch)
tree2f43ff8405a14088128817969d4512fd7e48ff42 /archaeological_operations/models.py
parenta381420582e7210e0336578a931759772118c136 (diff)
downloadIshtar-00eb1c670aac77cef068e656dcb0bb192c656936.tar.bz2
Ishtar-00eb1c670aac77cef068e656dcb0bb192c656936.zip
Operation / sites: attach query owns to item linked with warehouse
Diffstat (limited to 'archaeological_operations/models.py')
-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)