From 3fd126b25be6a50c49b4525941d216fa92f727b0 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Wed, 11 Mar 2020 13:27:04 +0100 Subject: Searc criteria: add has image/file/url criteria for all document items --- archaeological_operations/models.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'archaeological_operations/models.py') diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py index 8dd6568b8..8a415c0c5 100644 --- a/archaeological_operations/models.py +++ b/archaeological_operations/models.py @@ -180,6 +180,11 @@ class ArchaeologicalSite(DocumentItem, BaseHistorizedItem, QRCodeItem, } # alternative names of fields for searches + REVERSED_BOOL_FIELDS = [ + 'documents__image__isnull', + 'documents__associated_file__isnull', + 'documents__associated_url__isnull', + ] ALT_NAMES = { 'reference': SearchAltName( pgettext_lazy("key for text search", "reference"), @@ -264,6 +269,7 @@ class ArchaeologicalSite(DocumentItem, BaseHistorizedItem, QRCodeItem, ), } ALT_NAMES.update(BaseHistorizedItem.ALT_NAMES) + ALT_NAMES.update(DocumentItem.ALT_NAMES) UP_MODEL_QUERY = { "operation": (pgettext_lazy("key for text search", "operation"), @@ -694,6 +700,11 @@ class Operation(ClosedItem, DocumentItem, BaseHistorizedItem, QRCodeItem, # search parameters BOOL_FIELDS = ['end_date__isnull', 'virtual_operation', 'documentation_received', 'finds_received'] + REVERSED_BOOL_FIELDS = [ + 'documents__image__isnull', + 'documents__associated_file__isnull', + 'documents__associated_url__isnull', + ] DATED_FIELDS = [ 'start_date__lte', 'start_date__gte', 'excavation_end_date__lte', 'excavation_end_date__gte', 'documentation_deadline__lte', @@ -951,6 +962,8 @@ class Operation(ClosedItem, DocumentItem, BaseHistorizedItem, QRCodeItem, ), } ALT_NAMES.update(BaseHistorizedItem.ALT_NAMES) + ALT_NAMES.update(DocumentItem.ALT_NAMES) + QA_EDIT = QuickAction( url="operation-qa-bulk-update", icon_class="fa fa-pencil", text=_(u"Bulk update"), target="many", -- cgit v1.2.3