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_warehouse/forms.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'archaeological_warehouse/forms.py') diff --git a/archaeological_warehouse/forms.py b/archaeological_warehouse/forms.py index edc4a3b74..1e1979cac 100644 --- a/archaeological_warehouse/forms.py +++ b/archaeological_warehouse/forms.py @@ -30,11 +30,12 @@ from django.forms.formsets import formset_factory from ishtar_common.utils import ugettext_lazy as _ from ishtar_common.models import ( + Area, + Organization, Person, - valid_id, - Town, SpatialReferenceSystem, - Organization, + Town, + valid_id, valid_ids, ) from archaeological_operations.models import ArchaeologicalSite @@ -148,11 +149,11 @@ class WarehouseSelect(CustomForm, TableSelect): name = forms.CharField(label=_("Name")) warehouse_type = forms.ChoiceField(label=_("Warehouse type"), choices=[]) town = get_town_field(label=_("Town")) - - def __init__(self, *args, **kwargs): - super(WarehouseSelect, self).__init__(*args, **kwargs) - self.fields["warehouse_type"].choices = models.WarehouseType.get_types() - self.fields["warehouse_type"].help_text = models.WarehouseType.get_help() + area = forms.ChoiceField(label=_("Area"), choices=[]) + TYPES = [ + FieldType('area', Area), + FieldType("warehouse_type", models.WarehouseType), + ] class WarehouseFormSelection(LockForm, CustomFormSearch): @@ -514,6 +515,8 @@ class ContainerSelect(DocumentItemSelect): ) location_name = get_warehouse_field(label=_("Warehouse")) responsibility_name = get_warehouse_field(label=_("Warehouse (responsibility)")) + town = get_town_field(label=_("Warehouse - Town")) + area = forms.ChoiceField(label=_("Warehouse - Area"), choices=[]) container_type = forms.ChoiceField(label=_("Container type"), choices=[]) reference = forms.CharField(label=_("Ref.")) code = forms.CharField(label=_("Code")) @@ -600,6 +603,7 @@ class ContainerSelect(DocumentItemSelect): treatment_emergency = forms.ChoiceField(choices=[], label=_("Treatment emergency")) TYPES = [ + FieldType('area', Area), FieldType("integrities", IntegrityType), FieldType("remarkabilities", RemarkabilityType), FieldType("conservatory_state", ConservatoryState), -- cgit v1.2.3