summaryrefslogtreecommitdiff
path: root/archaeological_context_records/forms.py
diff options
context:
space:
mode:
Diffstat (limited to 'archaeological_context_records/forms.py')
-rw-r--r--archaeological_context_records/forms.py17
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