diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2020-05-25 16:06:30 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2020-05-25 16:06:30 +0200 |
commit | 95f3bdd01e9adfe9e69da5a61ddb788f54d3a1e3 (patch) | |
tree | 467b157dea9c9e228d048b50a17524f877bf29bc /archaeological_finds | |
parent | ba056933f0f33d03729b0bb445f073d693e305e1 (diff) | |
download | Ishtar-95f3bdd01e9adfe9e69da5a61ddb788f54d3a1e3.tar.bz2 Ishtar-95f3bdd01e9adfe9e69da5a61ddb788f54d3a1e3.zip |
Search finds - context records: add missing search criterias for datings
Diffstat (limited to 'archaeological_finds')
-rw-r--r-- | archaeological_finds/forms.py | 10 | ||||
-rw-r--r-- | archaeological_finds/models_finds.py | 5 |
2 files changed, 7 insertions, 8 deletions
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() diff --git a/archaeological_finds/models_finds.py b/archaeological_finds/models_finds.py index 68a7bfe51..51df74c20 100644 --- a/archaeological_finds/models_finds.py +++ b/archaeological_finds/models_finds.py @@ -1004,10 +1004,6 @@ class Find(BulkUpdatedItem, ValueGetter, DocumentItem, BaseHistorizedItem, pgettext_lazy("key for text search", "context-record-relation-type"), 'cr_relation_types'), - 'datings__period': - SearchAltName( - pgettext_lazy("key for text search", "period"), - 'datings__period__label__iexact'), 'material_types': SearchAltName( pgettext_lazy("key for text search", "material"), @@ -1363,6 +1359,7 @@ class Find(BulkUpdatedItem, ValueGetter, DocumentItem, BaseHistorizedItem, } ALT_NAMES.update(BaseHistorizedItem.ALT_NAMES) ALT_NAMES.update(DocumentItem.ALT_NAMES) + ALT_NAMES.update(Dating.ASSOCIATED_ALT_NAMES) DYNAMIC_REQUESTS = { 'current_division': DynamicRequest( |