From 1d049ac1cac1aa74610e298f5d074527dabdbb5c Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Thu, 6 Feb 2025 17:56:14 +0100 Subject: ✨ Town, area searches for person, organisations, archaeological files, context records, warehouses and containers (refs #6095) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- archaeological_context_records/forms.py | 5 ++++- archaeological_context_records/models.py | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'archaeological_context_records') diff --git a/archaeological_context_records/forms.py b/archaeological_context_records/forms.py index eb6b57b63..95980b34e 100644 --- a/archaeological_context_records/forms.py +++ b/archaeological_context_records/forms.py @@ -32,10 +32,11 @@ from django.forms.formsets import formset_factory from ishtar_common.utils import get_current_profile, ugettext_lazy as _ from ishtar_common.models import ( - valid_id, + Area, IshtarSiteProfile, Town, SpatialReferenceSystem, + valid_id, valid_ids, ) from archaeological_context_records import models @@ -140,6 +141,7 @@ class RecordSelect(GeoItemSelect, PeriodSelect): ) label = forms.CharField(label=_("ID"), max_length=100) town = get_town_field() + area = forms.ChoiceField(label=_("Area"), choices=[]) if settings.COUNTRY == "fr": operation__code_patriarche = forms.CharField( max_length=500, widget=OAWidget, label=_("Code PATRIARCHE") @@ -189,6 +191,7 @@ class RecordSelect(GeoItemSelect, PeriodSelect): details_on_color = forms.CharField(label=_("Details on color")) TYPES = PeriodSelect.TYPES + [ + FieldType('area', Area), FieldType('cultural_attributions', models.CulturalAttributionType), FieldType("unit", models.Unit), FieldType("cr_relation_types", models.RelationType), diff --git a/archaeological_context_records/models.py b/archaeological_context_records/models.py index 8046cef7e..eae4e3720 100644 --- a/archaeological_context_records/models.py +++ b/archaeological_context_records/models.py @@ -633,6 +633,9 @@ class ContextRecord( "town": SearchAltName( pgettext_lazy("key for text search", "town"), "town__cached_label__iexact" ), + "area": SearchAltName( + pgettext_lazy("key for text search", "area"), "town__areas__label__iexact" + ), "operation__year": SearchAltName( pgettext_lazy("key for text search", "operation-year"), "operation__year" ), -- cgit v1.2.3