From f2133b1363d3d275ce063c0cddebb3fb862e2637 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Mon, 8 Jul 2024 14:09:48 +0200 Subject: ✨ Context records - identification: switch to multivalued MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- archaeological_context_records/forms.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'archaeological_context_records/forms.py') diff --git a/archaeological_context_records/forms.py b/archaeological_context_records/forms.py index 2ddb8c42d..3a04567ba 100644 --- a/archaeological_context_records/forms.py +++ b/archaeological_context_records/forms.py @@ -156,7 +156,7 @@ class RecordSelect(GeoItemSelect, PeriodSelect): ) unit = forms.ChoiceField(label=_("Unit type"), choices=[]) activity = forms.ChoiceField(label=_("Activity"), choices=[]) - identification = forms.ChoiceField(label=_("Identification"), choices=[]) + identifications = forms.ChoiceField(label=_("Identification"), choices=[]) cultural_attributions = forms.ChoiceField( label=_("Cultural attribution"), choices=[], required=False) parcel = forms.CharField(label=_("Parcel")) @@ -173,7 +173,7 @@ class RecordSelect(GeoItemSelect, PeriodSelect): FieldType("ope_relation_types", OpeRelationType), FieldType("excavation_technics", models.ExcavationTechnicType), FieldType("activity", models.ActivityType), - FieldType("identification", models.IdentificationType), + FieldType("identifications", models.IdentificationType), ] + GeoItemSelect.TYPES SITE_KEYS = {"archaeological_site": None} @@ -494,7 +494,7 @@ class RecordFormInterpretation(CustomForm, ManageOldType): form_label = _("Interpretation") form_admin_name = _("Context record - 040 - Interpretation") form_slug = "contextrecord-040-interpretation" - base_models = ["cultural_attribution"] + base_models = ["cultural_attribution", "identification"] associated_models = { "activity": models.ActivityType, @@ -505,8 +505,10 @@ class RecordFormInterpretation(CustomForm, ManageOldType): label=_("Interpretation"), widget=forms.Textarea, required=False ) activity = forms.ChoiceField(label=_("Activity"), required=False, choices=[]) - identification = forms.ChoiceField( - label=_("Identification"), required=False, choices=[] + identification = forms.MultipleChoiceField( + label=_("Identification"), choices=[], + widget=widgets.Select2Multiple, + required=False ) HEADERS['taq'] = FormHeader(_("Dating complements")) taq = forms.IntegerField(label=_("TAQ"), required=False) @@ -516,14 +518,15 @@ class RecordFormInterpretation(CustomForm, ManageOldType): cultural_attribution = forms.MultipleChoiceField( label=_("Cultural attributions"), choices=[], widget=widgets.Select2Multiple, - required=False) + required=False + ) datings_comment = forms.CharField( label=_("Comments on dating"), required=False, widget=forms.Textarea ) TYPES = [ FieldType("activity", models.ActivityType), - FieldType("identification", models.IdentificationType), + FieldType("identification", models.IdentificationType, True), FieldType('cultural_attribution', models.CulturalAttributionType, True), ] -- cgit v1.2.3