summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2026-04-01 15:59:39 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2026-04-02 13:30:50 +0200
commit4d8f427560a336d24c158d34b7500a75c454134d (patch)
tree5f5351d0c0ff3f0394239d1d4a56c372f5771d44
parent205ad98138447af4b86cd11d38c3c382ea1656cd (diff)
downloadIshtar-4d8f427560a336d24c158d34b7500a75c454134d.tar.bz2
Ishtar-4d8f427560a336d24c158d34b7500a75c454134d.zip
✨ sites - search: add heritage and datings fields
-rw-r--r--archaeological_operations/forms.py71
-rw-r--r--archaeological_operations/models.py41
2 files changed, 90 insertions, 22 deletions
diff --git a/archaeological_operations/forms.py b/archaeological_operations/forms.py
index a96ce7c63..79e265e93 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, \
reverse_lazy, get_data_from_formset, QAForm, CustomFormSearch,\
ManageOldType, IshtarForm, CustomForm, FieldType, FormHeader, \
- GeoItemSelect, LockForm, MultiSearchForm, DocumentItemSelect
+ GeoItemSelect, LockForm, MultiSearchForm, DocumentItemSelect, DatingSelect
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, \
@@ -1173,7 +1173,7 @@ class OperationDeletionForm(FinalForm):
#########
-class SiteSelect(GeoItemSelect):
+class SiteSelect(GeoItemSelect, DatingSelect):
_model = models.ArchaeologicalSite
form_admin_name = _("Archaeological site - 001 - Search")
form_slug = "archaeological_site-001-search"
@@ -1186,23 +1186,48 @@ class SiteSelect(GeoItemSelect):
name = forms.CharField(label=_("Name"), max_length=200, required=False)
other_reference = forms.CharField(label=_("Other reference"),
max_length=200, required=False)
- types = widgets.Select2MultipleField(label=_("Types"), required=False)
+ types = widgets.Select2SimpleField(label=_("Types"), required=False,
+ modal="modal-advanced-search")
+ heritage_interest = forms.ChoiceField(label=_("Heritage interests"), choices=[],
+ required=False)
+ actors = forms.IntegerField(
+ label=_("Actors"), required=False,
+ widget=widgets.JQueryAutoComplete(
+ reverse_lazy('autocomplete-qualifiedbiographicalnote')))
+ collaborators = forms.IntegerField(
+ label=_("Collaborators"), required=False,
+ widget=widgets.JQueryAutoComplete(
+ reverse_lazy('autocomplete-person')))
+ protection_id = forms.CharField(label=_("Protection ID"), required=False)
+ protection_date = DateField(label=_("Protection date"), required=False)
+ heritage_environmental_protections = forms.ChoiceField(
+ label=_("Heritage and environmental protections"), choices=[],
+ required=False)
+ details_on_protection = forms.CharField(label=_("Details on protection"),
+ required=False)
discoverer = forms.IntegerField(
- widget=widgets.JQueryAutoComplete(reverse_lazy('autocomplete-person'), associated_model=Person),
+ widget=widgets.JQueryAutoComplete(reverse_lazy('autocomplete-person'),
+ associated_model=Person),
label=_("Discoverer"))
- periods = forms.ChoiceField(label=_("Periods"), choices=[], required=False)
- remains = forms.ChoiceField(label=_("Remains"), choices=[], required=False)
- cultural_attributions = forms.ChoiceField(
- label=_("Cultural attribution"), choices=[], required=False)
- discovery_status = forms.ChoiceField(label=_("Discovery status"), choices=[], required=False)
- current_status = forms.ChoiceField(label=_("Current status"), choices=[], required=False)
- nature_of_site = forms.ChoiceField(label=_("Nature of site"), choices=[], required=False)
- interpretation_level = forms.ChoiceField(label=_("Interpretation level"), choices=[], required=False)
+ periods = widgets.Select2SimpleField(label=_("Periods"), required=False,
+ modal="modal-advanced-search")
+ remains = widgets.Select2SimpleField(label=_("Remains"), required=False,
+ modal="modal-advanced-search")
+ cultural_attributions = widgets.Select2SimpleField(
+ label=_("Cultural attributions"), required=False, modal="modal-advanced-search")
+ discovery_status = forms.ChoiceField(label=_("Discovery status"), choices=[],
+ required=False)
+ current_states = forms.ChoiceField(label=_("Current states"), required=False)
+ nature_of_site = forms.ChoiceField(label=_("Nature of site"), choices=[],
+ required=False)
+ interpretation_level = forms.ChoiceField(label=_("Interpretation level"),
+ choices=[], required=False)
+
towns = get_town_field()
towns__areas = forms.ChoiceField(label=_("Areas"), choices=[])
- description = forms.CharField(label=_("Description"), max_length=200, required=False)
- public_description = forms.CharField(label=_("Public description"), max_length=200, required=False)
- comment = forms.CharField(label=_("Comment"), max_length=200, required=False)
+ description = forms.CharField(label=_("Description"), required=False)
+ public_description = forms.CharField(label=_("Public description"), required=False)
+ comment = forms.CharField(label=_("Comment"), required=False)
top_operation = forms.IntegerField(
label=_("Top operation"), required=False,
widget=widgets.JQueryAutoComplete(
@@ -1241,17 +1266,26 @@ class SiteSelect(GeoItemSelect):
discovery_area = forms.CharField(
label=_("Discovery area"), max_length=200,
required=False)
+
+ editors = forms.IntegerField(
+ label=_("Editors"), required=False,
+ widget=widgets.JQueryAutoComplete(
+ reverse_lazy('autocomplete-author')))
+
TYPES = [
FieldType('periods', models.Period),
FieldType('remains', models.RemainType),
- FieldType("types", models.SiteType, is_multiple=True),
- FieldType('current_status', models.SiteCurrentStatusType),
+ FieldType("types", models.SiteType),
+ FieldType('current_states', models.SiteCurrentStatusType),
FieldType('discovery_status', models.SiteDiscoveryStatusType),
FieldType('cultural_attributions', models.CulturalAttributionType),
FieldType('nature_of_site', models.NatureOfSiteType),
FieldType('interpretation_level', models.InterpretationLevelType),
FieldType('towns__areas', Area),
- ] + GeoItemSelect.TYPES
+ FieldType('heritage_interest', models.HeritageInterestType),
+ FieldType('heritage_environmental_protections',
+ models.HeritageAndEnvironmentalProtectionType),
+ ] + GeoItemSelect.TYPES + DatingSelect.TYPES
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
@@ -1265,6 +1299,7 @@ class SiteSelect(GeoItemSelect):
'affmar_number',
'drassm_number',
))
+ self._reorder_period_fields("comment")
class SiteFormSelection(LockForm, CustomFormSearch):
diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py
index 7bf654639..c34478b6c 100644
--- a/archaeological_operations/models.py
+++ b/archaeological_operations/models.py
@@ -475,8 +475,8 @@ class ArchaeologicalSite(
"heritage_environmental_protections"
]
- DATED_FIELDS = BaseHistorizedItem.DATED_FIELDS + ["sinking_date"]
- NUMBER_FIELDS = GeographicTownItem.NUMBER_FIELDS[:]
+ DATED_FIELDS = BaseHistorizedItem.DATED_FIELDS + ["sinking_date", "protection_date"]
+ NUMBER_FIELDS = GeographicTownItem.NUMBER_FIELDS[:] + BaseDating.NUMBER_FIELDS
EXTRA_REQUEST_KEYS = {
"towns_label": "towns",
@@ -516,9 +516,41 @@ class ArchaeologicalSite(
pgettext_lazy("key for text search", "discovery-status"),
"discovery_status__label__iexact"
),
- "current_status": SearchAltName(
+ "current_states": SearchAltName(
pgettext_lazy("key for text search", "current-status"),
- "current_status__label__iexact"
+ "current_states__label__iexact"
+ ),
+ "actors": SearchAltName(
+ pgettext_lazy("key for text search", "actors"),
+ "actors__cached_label__iexact"
+ ),
+ "collaborators": SearchAltName(
+ pgettext_lazy("key for text search", "collaborators"),
+ "collaborators__cached_label__iexact"
+ ),
+ "editors": SearchAltName(
+ pgettext_lazy("key for text search", "editor"),
+ "editors__cached_label__iexact"
+ ),
+ "protection_id": SearchAltName(
+ pgettext_lazy("key for text search", "protection-id"),
+ "protection_id__iexact"
+ ),
+ "protection_date": SearchAltName(
+ pgettext_lazy("key for text search", "protection-date"),
+ "protection_date"
+ ),
+ "details_on_protection": SearchAltName(
+ pgettext_lazy("key for text search", "protection-details"),
+ "details_on_protection__iexact"
+ ),
+ "heritage_interest": SearchAltName(
+ pgettext_lazy("key for text search", "heritage-interest"),
+ "heritage_interests__label__iexact"
+ ),
+ "heritage_environmental_protections": SearchAltName(
+ pgettext_lazy("key for text search", "heritage-environmental-protection"),
+ "heritage_environmental_protections__label__iexact"
),
"nature_of_site": SearchAltName(
pgettext_lazy("key for text search", "nature"),
@@ -606,6 +638,7 @@ class ArchaeologicalSite(
ALT_NAMES.update(DocumentItem.ALT_NAMES)
ALT_NAMES.update(GeoItem.ALT_NAMES)
ALT_NAMES.update(Imported.ALT_NAMES)
+ ALT_NAMES.update(BaseDating.ALT_NAMES)
DEFAULT_SEARCH_FORM = ("archaeological_operations.forms", "SiteSelect")