diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2022-10-17 15:05:03 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2022-12-12 12:23:19 +0100 |
commit | 4d2730f4003347eab7c25a5f0b3f01918e522d5a (patch) | |
tree | 67ba67af8d87a8479d4d53f4c3aaec55fc39e9d9 /archaeological_context_records/forms.py | |
parent | 5a09ae075099e2cf6f509947daaf73074c7822fe (diff) | |
download | Ishtar-4d2730f4003347eab7c25a5f0b3f01918e522d5a.tar.bz2 Ishtar-4d2730f4003347eab7c25a5f0b3f01918e522d5a.zip |
Context records: Excavation technic become many2many
Diffstat (limited to 'archaeological_context_records/forms.py')
-rw-r--r-- | archaeological_context_records/forms.py | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/archaeological_context_records/forms.py b/archaeological_context_records/forms.py index 0e06ae2e5..8d05e50e1 100644 --- a/archaeological_context_records/forms.py +++ b/archaeological_context_records/forms.py @@ -170,13 +170,13 @@ class RecordSelect(DocumentItemSelect, PeriodSelect): cr_relation_types = forms.ChoiceField( label=_("Search within relations"), choices=[] ) - excavation_technic = forms.ChoiceField(label=_("Excavation technique"), choices=[]) + excavation_technics = forms.ChoiceField(label=_("Excavation technique"), choices=[]) TYPES = PeriodSelect.TYPES + [ FieldType("unit", models.Unit), FieldType("cr_relation_types", models.RelationType), FieldType("ope_relation_types", OpeRelationType), - FieldType("excavation_technic", models.ExcavationTechnicType), + FieldType("excavation_technics", models.ExcavationTechnicType), ] SITE_KEYS = {"archaeological_site": None} @@ -273,7 +273,7 @@ class RecordFormGeneral(CustomForm, ManageOldType): form_admin_name = _("Context record - 020 - General") form_slug = "contextrecord-020-general" file_upload = True - base_models = ["documentation"] + base_models = ["documentation", "excavation_technic"] associated_models = { "archaeological_site": ArchaeologicalSite, "parcel": Parcel, @@ -304,8 +304,11 @@ class RecordFormGeneral(CustomForm, ManageOldType): comment = forms.CharField( label=_("General comment"), widget=forms.Textarea, required=False ) - excavation_technic = forms.ChoiceField( - label=_("Excavation technique"), choices=[], required=False + excavation_technic = forms.MultipleChoiceField( + label=_("Excavation technique"), + choices=[], + required=False, + widget=widgets.Select2Multiple, ) surface = forms.FloatField( required=False, @@ -362,7 +365,7 @@ class RecordFormGeneral(CustomForm, ManageOldType): TYPES = [ FieldType("unit", models.Unit), - FieldType("excavation_technic", models.ExcavationTechnicType), + FieldType("excavation_technic", models.ExcavationTechnicType, is_multiple=True), FieldType("documentation", models.DocumentationType, is_multiple=True), FieldType("spatial_reference_system", SpatialReferenceSystem), ] @@ -455,7 +458,7 @@ class RecordFormGeneral(CustomForm, ManageOldType): if not self.cleaned_data.get("parcel", None) and not self.cleaned_data.get( "town", None ): - raise forms.ValidationError(_("You have to choose a town or a " "parcel.")) + raise forms.ValidationError(_("You have to choose a town or a parcel.")) return cleaned_data |