summaryrefslogtreecommitdiff
path: root/archaeological_operations
diff options
context:
space:
mode:
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
commitc9b07622ebf6f6dcceff3d6906d3ed33d74f24fd (patch)
treec248b4e8b129d017373af2a07d399f5ca82717b1 /archaeological_operations
parentdf67b2c757e813512a6e5f1ea31f8a4693444013 (diff)
downloadIshtar-c9b07622ebf6f6dcceff3d6906d3ed33d74f24fd.tar.bz2
Ishtar-c9b07622ebf6f6dcceff3d6906d3ed33d74f24fd.zip
Searc criteria: add has image/file/url criteria for all document items
Diffstat (limited to 'archaeological_operations')
-rw-r--r--archaeological_operations/forms.py6
-rw-r--r--archaeological_operations/models.py13
2 files changed, 16 insertions, 3 deletions
diff --git a/archaeological_operations/forms.py b/archaeological_operations/forms.py
index 9a3335df5..d665fc779 100644
--- a/archaeological_operations/forms.py
+++ b/archaeological_operations/forms.py
@@ -41,7 +41,7 @@ from ishtar_common import widgets
from ishtar_common.forms import FinalForm, FormSet, get_now, \
reverse_lazy, TableSelect, get_data_from_formset, QAForm, CustomFormSearch,\
ManageOldType, IshtarForm, CustomForm, FieldType, FormHeader, \
- HistorySelect, LockForm, MultiSearchForm
+ DocumentItemSelect, LockForm, MultiSearchForm
from ishtar_common.forms_common import TownFormSet, get_town_field, TownForm
from ishtar_common.models import valid_id, valid_ids, Person, Town, \
DocumentTemplate, Organization, get_current_profile, \
@@ -472,7 +472,7 @@ RecordRelationsFormSet.form_admin_name = _(u"Operation - 080 - Relations")
RecordRelationsFormSet.form_slug = "operation-080-relations"
-class OperationSelect(HistorySelect):
+class OperationSelect(DocumentItemSelect):
_model = models.Operation
form_admin_name = _(u"Operation - 001 - Search")
form_slug = "operation-001-search"
@@ -1367,7 +1367,7 @@ class OperationDeletionForm(FinalForm):
#########
-class SiteSelect(HistorySelect):
+class SiteSelect(DocumentItemSelect):
_model = models.ArchaeologicalSite
form_admin_name = _(u"Archaeological site - 001 - Search")
form_slug = "archaeological_site-001-search"
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",