From 95f3bdd01e9adfe9e69da5a61ddb788f54d3a1e3 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Mon, 25 May 2020 16:06:30 +0200 Subject: Search finds - context records: add missing search criterias for datings --- archaeological_finds/forms.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'archaeological_finds/forms.py') diff --git a/archaeological_finds/forms.py b/archaeological_finds/forms.py index 7cbbca81c..504998528 100644 --- a/archaeological_finds/forms.py +++ b/archaeological_finds/forms.py @@ -53,11 +53,14 @@ from archaeological_operations.widgets import OAWidget from archaeological_warehouse.models import Warehouse from bootstrap_datepicker.widgets import DatePicker from ishtar_common import widgets + from ishtar_common.forms import CustomForm, CustomFormSearch, FormSet, \ FloatField, reverse_lazy, TableSelect, get_now, FinalForm, \ ManageOldType, FieldType, IshtarForm, FormHeader, QAForm, \ MultiSearchForm, LockForm, DocumentItemSelect from ishtar_common.forms_common import get_town_field +from archaeological_context_records.forms import PeriodSelect + from ishtar_common.models import valid_id, valid_ids, get_current_profile, \ SpatialReferenceSystem, Area, OperationType, IshtarUser from ishtar_common.utils import convert_coordinates_to_point @@ -908,7 +911,7 @@ DatingFormSet.form_admin_name = _(u"Find - 040 - Dating") DatingFormSet.form_slug = "find-040-dating" -class FindSelect(DocumentItemSelect): +class FindSelect(DocumentItemSelect, PeriodSelect): _model = models.Find form_admin_name = _("Find - 001 - Search") form_slug = "find-001-search" @@ -1076,7 +1079,6 @@ class FindSelect(DocumentItemSelect): cultural_attributions = forms.ChoiceField( label=_("Cultural attribution"), choices=[], required=False) - datings__period = forms.ChoiceField(label=_(u"Period"), choices=[]) dating_comment = forms.CharField(label=_(u"Comment on dating")) length__higher = FloatField(label=_(u"Length - higher than (cm)"), @@ -1187,8 +1189,7 @@ class FindSelect(DocumentItemSelect): label=_(u"Treatment file end date before"), widget=DatePicker ) - TYPES = [ - FieldType('datings__period', Period), + TYPES = PeriodSelect.TYPES + [ FieldType('conservatory_state', models.ConservatoryState), FieldType('base_finds__batch', models.BatchType), FieldType('preservation_to_considers', models.TreatmentType), @@ -1221,6 +1222,7 @@ class FindSelect(DocumentItemSelect): if 'cr_relation_types' in self.fields: self.fields['cr_relation_types'].choices = CRRelationType.get_types( ) + self._reorder_period_fields("cultural_attributions") def get_input_ids(self): ids = super(FindSelect, self).get_input_ids() -- cgit v1.2.3