From 7425ac6cb4b08a2933805b0de4594a2efbeacb32 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Wed, 2 Sep 2020 08:38:11 +0200 Subject: Search - criteria: "has finds" for operation and context record search --- archaeological_context_records/forms.py | 1 + archaeological_context_records/models.py | 5 +++++ 2 files changed, 6 insertions(+) (limited to 'archaeological_context_records') diff --git a/archaeological_context_records/forms.py b/archaeological_context_records/forms.py index 91c2fdf63..19df6aecc 100644 --- a/archaeological_context_records/forms.py +++ b/archaeological_context_records/forms.py @@ -133,6 +133,7 @@ class RecordSelect(DocumentItemSelect, PeriodSelect): label=_(u"Search within related operations"), choices=[]) unit = forms.ChoiceField(label=_(u"Unit type"), choices=[]) parcel = forms.CharField(label=_(u"Parcel")) + has_finds = forms.NullBooleanField(label=_("Has finds")) cr_relation_types = forms.ChoiceField( label=_(u"Search within relations"), choices=[]) diff --git a/archaeological_context_records/models.py b/archaeological_context_records/models.py index 84e2b3542..5e08ce6ae 100644 --- a/archaeological_context_records/models.py +++ b/archaeological_context_records/models.py @@ -400,6 +400,7 @@ class ContextRecord(BulkUpdatedItem, DocumentItem, BaseHistorizedItem, 'operation_id': 'operation_id', 'unit__label': "unit__label" } + MANY_COUNTED_FIELDS = ['base_finds'] REVERSED_BOOL_FIELDS = [ 'documents__image__isnull', 'documents__associated_file__isnull', @@ -453,6 +454,10 @@ class ContextRecord(BulkUpdatedItem, DocumentItem, BaseHistorizedItem, pgettext_lazy("key for text search", "parcel"), 'parcel__cached_label__iexact' ), + 'has_finds': SearchAltName( + pgettext_lazy("key for text search", "has-finds"), + 'base_finds' + ), 'cr_relation_types': SearchAltName( pgettext_lazy("key for text search", "record-relation-type"), 'cr_relation_types' -- cgit v1.2.3