diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2020-03-11 13:27:04 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2020-03-11 13:27:04 +0100 |
commit | c9b07622ebf6f6dcceff3d6906d3ed33d74f24fd (patch) | |
tree | c248b4e8b129d017373af2a07d399f5ca82717b1 /archaeological_finds/models_treatments.py | |
parent | df67b2c757e813512a6e5f1ea31f8a4693444013 (diff) | |
download | Ishtar-c9b07622ebf6f6dcceff3d6906d3ed33d74f24fd.tar.bz2 Ishtar-c9b07622ebf6f6dcceff3d6906d3ed33d74f24fd.zip |
Searc criteria: add has image/file/url criteria for all document items
Diffstat (limited to 'archaeological_finds/models_treatments.py')
-rw-r--r-- | archaeological_finds/models_treatments.py | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/archaeological_finds/models_treatments.py b/archaeological_finds/models_treatments.py index a8a06ae27..071d80af1 100644 --- a/archaeological_finds/models_treatments.py +++ b/archaeological_finds/models_treatments.py @@ -74,7 +74,11 @@ class Treatment(DashboardFormItem, ValueGetter, DocumentItem, 'person__cached_label', 'start_date', 'downstream_cached_label', 'upstream_cached_label') - REVERSED_BOOL_FIELDS = ['documents__image__isnull'] + REVERSED_BOOL_FIELDS = [ + 'documents__image__isnull', + 'documents__associated_file__isnull', + 'documents__associated_url__isnull', + ] EXTRA_REQUEST_KEYS = { "downstream_cached_label": "downstream__cached_label", "upstream_cached_label": "upstream__cached_label", @@ -115,10 +119,6 @@ class Treatment(DashboardFormItem, ValueGetter, DocumentItem, pgettext_lazy("key for text search", "index"), 'index' ), - 'documents__image__isnull': SearchAltName( - pgettext_lazy("key for text search", "has-image"), - 'documents__image__isnull' - ), 'treatment_types': SearchAltName( pgettext_lazy("key for text search", "type"), 'treatment_types__label__iexact' @@ -129,6 +129,7 @@ class Treatment(DashboardFormItem, ValueGetter, DocumentItem, ), } ALT_NAMES.update(BaseHistorizedItem.ALT_NAMES) + ALT_NAMES.update(DocumentItem.ALT_NAMES) HISTORICAL_M2M = [ 'treatment_types', ] @@ -914,6 +915,11 @@ class TreatmentFile(DashboardFormItem, ClosedItem, DocumentItem, "in_charge__pk": "in_charge__pk", # used by dynamic_table_documents "applicant__pk": "applicant__pk", # used by dynamic_table_documents } + REVERSED_BOOL_FIELDS = [ + 'documents__image__isnull', + 'documents__associated_file__isnull', + 'documents__associated_url__isnull', + ] # alternative names of fields for searches ALT_NAMES = { 'name': SearchAltName( @@ -966,6 +972,7 @@ class TreatmentFile(DashboardFormItem, ClosedItem, DocumentItem, ), } ALT_NAMES.update(BaseHistorizedItem.ALT_NAMES) + ALT_NAMES.update(DocumentItem.ALT_NAMES) DATED_FIELDS = ['exhibition_start_date__lte', 'exhibition_start_date__gte', |