diff options
Diffstat (limited to 'archaeological_files')
-rw-r--r-- | archaeological_files/forms.py | 18 | ||||
-rw-r--r-- | archaeological_files/models.py | 4 |
2 files changed, 10 insertions, 12 deletions
diff --git a/archaeological_files/forms.py b/archaeological_files/forms.py index 6c18d675c..46b755ab6 100644 --- a/archaeological_files/forms.py +++ b/archaeological_files/forms.py @@ -29,26 +29,18 @@ from django.conf import settings from django.core import validators from django.db.models import Q from django.forms.formsets import formset_factory -from django.utils.functional import lazy from django.utils.safestring import mark_safe from ishtar_common.utils import ugettext_lazy as _ from ishtar_common.models import ( - Person, + Area, Organization, + organization_type_pks_lazy, + Person, + person_type_pk_lazy, Town, valid_id, valid_ids, - person_type_pks_lazy, - person_type_pk_lazy, - organization_type_pks_lazy, - organization_type_pk_lazy, - get_sra_agent_label, - get_sra_agent_head_scientist_label, - get_orga_general_contractor_label, - get_general_contractor_label, - get_orga_planning_service_label, - get_responsible_planning_service_label, ) from ishtar_common.models_common import Department from archaeological_operations.models import ActType, AdministrativeAct, OperationType @@ -93,6 +85,7 @@ class FileSelect(DocumentItemSelect): numeric_reference = forms.IntegerField(label=_("Numeric reference")) internal_reference = forms.CharField(max_length=200, label=_("Other reference")) towns = get_town_field() + area = forms.ChoiceField(label=_("Area"), choices=[]) parcel = forms.CharField(label=_("Parcel")) if settings.ISHTAR_DPTS: towns__numero_insee__startswith = forms.ChoiceField( @@ -162,6 +155,7 @@ class FileSelect(DocumentItemSelect): FieldType("monitoring_justification", models.MonitoringJustificationType), FieldType("permit_type", models.PermitType), FieldType("file_type", models.FileType), + FieldType('area', Area), ] def __init__(self, *args, **kwargs): diff --git a/archaeological_files/models.py b/archaeological_files/models.py index 2bc402f73..da36e40b7 100644 --- a/archaeological_files/models.py +++ b/archaeological_files/models.py @@ -609,6 +609,10 @@ class File( "general_contractor__attached_to__cached_label__iexact", related_name="general_contractor__attached_to" ), + "area": SearchAltName( + pgettext_lazy("key for text search", "area"), + "towns__areas__label__iexact" + ), } ALT_NAMES.update(BaseHistorizedItem.ALT_NAMES) ALT_NAMES.update(DocumentItem.ALT_NAMES) |