diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-10-01 15:10:07 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-10-24 12:06:08 +0200 |
commit | e55d8d335b682f86439457c577c95b1768543f22 (patch) | |
tree | 8d6e00ce0a1a19b41869b6b6b2ebc5afbb133b64 /archaeological_finds | |
parent | 179b51b530687a6d81c1434d13d12c02afe7abff (diff) | |
download | Ishtar-e55d8d335b682f86439457c577c95b1768543f22.tar.bz2 Ishtar-e55d8d335b682f86439457c577c95b1768543f22.zip |
Manage site and warehouse in shortcut menu - Many fixes on pin
Diffstat (limited to 'archaeological_finds')
-rw-r--r-- | archaeological_finds/models_finds.py | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/archaeological_finds/models_finds.py b/archaeological_finds/models_finds.py index fb7a8802a..b2053cb46 100644 --- a/archaeological_finds/models_finds.py +++ b/archaeological_finds/models_finds.py @@ -43,6 +43,7 @@ from ishtar_common.models import Document, GeneralType, \ from archaeological_operations.models import AdministrativeAct, Operation from archaeological_context_records.models import ContextRecord, Dating +from archaeological_warehouse.models import Warehouse class MaterialType(HierarchicalType): @@ -678,11 +679,6 @@ class Find(BulkUpdatedItem, ValueGetter, BaseHistorizedItem, OwnPerms, 'cr_relation_types': 'base_finds__context_record__', } - RELATIVE_SESSION_NAMES = [ - ('contextrecord', 'base_finds__context_record__pk'), - ('operation', 'base_finds__context_record__operation__pk'), - ('file', 'base_finds__context_record__operation__associated_file__pk') - ] BASE_REQUEST = {'downstream_treatment__isnull': True} EXTRA_REQUEST_KEYS = { 'base_finds__context_record': @@ -900,11 +896,25 @@ class Find(BulkUpdatedItem, ValueGetter, BaseHistorizedItem, OwnPerms, ), ] UP_MODEL_QUERY = { - "OPE": (pgettext_lazy("key for text search", u"operation"), - 'cached_label'), - "UE": (pgettext_lazy("key for text search", u"context-record"), - 'cached_label'), + "operation": (pgettext_lazy("key for text search", u"operation"), + 'cached_label'), + "contextrecord": ( + pgettext_lazy("key for text search", u"context-record"), + 'cached_label'), + "warehouse": ( + pgettext_lazy("key for text search", u"location"), + 'name'), + "site": ( + pgettext_lazy("key for text search", u"context-record-site"), + 'cached_label'), } + RELATIVE_SESSION_NAMES = [ + ('contextrecord', 'base_finds__context_record__pk'), + ('operation', 'base_finds__context_record__operation__pk'), + ('file', 'base_finds__context_record__operation__associated_file__pk'), + ('warehouse', 'container__location__pk'), + ('site', 'base_finds__context_record__archaeological_site__pk') + ] # fields base_finds = models.ManyToManyField(BaseFind, verbose_name=_(u"Base find"), @@ -1291,6 +1301,12 @@ class Find(BulkUpdatedItem, ValueGetter, BaseHistorizedItem, OwnPerms, @classmethod def get_query_owns(cls, ishtaruser): q = cls._construct_query_own( + 'container__location__', + Warehouse._get_query_owns_dicts(ishtaruser) + ) | cls._construct_query_own( + 'container__responsible__', + Warehouse._get_query_owns_dicts(ishtaruser) + ) | cls._construct_query_own( 'base_finds__context_record__operation__', Operation._get_query_owns_dicts(ishtaruser) ) | cls._construct_query_own('', [ |