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.py79
1 files changed, 58 insertions, 21 deletions
diff --git a/archaeological_context_records/forms.py b/archaeological_context_records/forms.py
index 8d41a7888..0971fe363 100644
--- a/archaeological_context_records/forms.py
+++ b/archaeological_context_records/forms.py
@@ -279,7 +279,7 @@ class RecordFormGeneral(CustomForm, ManageOldType):
form_admin_name = _("Context record - 020 - General")
form_slug = "contextrecord-020-general"
file_upload = True
- base_models = ["documentation", "excavation_technic"]
+ base_models = ["documentation", "excavation_technic", "structure", "texture", "color", "inclusion"]
associated_models = {
"archaeological_site": ArchaeologicalSite,
"parcel": Parcel,
@@ -288,6 +288,10 @@ class RecordFormGeneral(CustomForm, ManageOldType):
"documentation": models.DocumentationType,
"spatial_reference_system": SpatialReferenceSystem,
"excavation_technic": models.ExcavationTechnicType,
+ "structure": models.StructureType,
+ "texture": models.TextureType,
+ "color": models.ColorType,
+ "inclusion": models.InclusionType,
}
pk = forms.IntegerField(required=False, widget=forms.HiddenInput)
operation_id = forms.IntegerField(widget=forms.HiddenInput)
@@ -297,62 +301,95 @@ class RecordFormGeneral(CustomForm, ManageOldType):
label=" ",
choices=[],
required=False,
- help_text=_("Only the items associated to the operation can be " "selected."),
+ help_text=_("Only the items associated to the operation can be selected."),
)
label = forms.CharField(
label=_("ID"), validators=[validators.MaxLengthValidator(200)]
)
unit = forms.ChoiceField(label=_("Context record type"), required=False, choices=[])
- description = forms.CharField(
- label=_("Description"), widget=forms.Textarea, required=False
- )
- filling = forms.CharField(label=_("Filling"), widget=forms.Textarea, required=False)
comment = forms.CharField(
label=_("General comment"), widget=forms.Textarea, required=False
)
+ HEADERS["excavation_technic"] = FormHeader(_("Description"))
excavation_technic = forms.MultipleChoiceField(
label=_("Excavation techniques"),
choices=[],
required=False,
widget=widgets.Select2Multiple,
)
+ documentation = forms.MultipleChoiceField(
+ label=_("Documentation"),
+ choices=[],
+ required=False,
+ widget=widgets.Select2Multiple,
+ )
+ opening_date = DateField(label=_("Opening date"), required=False)
+ closing_date = DateField(label=_("Closing date"), required=False)
+ filling = forms.CharField(label=_("Filling"), widget=forms.Textarea, required=False)
+ location = forms.CharField(
+ label=_("Location"),
+ widget=forms.Textarea,
+ required=False,
+ validators=[validators.MaxLengthValidator(200)],
+ )
+ description = forms.CharField(
+ label=_("Description"), widget=forms.Textarea, required=False
+ )
+ structure = forms.MultipleChoiceField(
+ label=_("Structure"),
+ choices=[],
+ required=False,
+ widget=widgets.Select2Multiple,
+ )
+ texture = forms.MultipleChoiceField(
+ label=_("Texture"),
+ choices=[],
+ required=False,
+ widget=widgets.Select2Multiple,
+ )
+ inclusion = forms.MultipleChoiceField(
+ label=_("Inclusions"),
+ choices=[],
+ required=False,
+ widget=widgets.Select2Multiple,
+ )
+ color = forms.MultipleChoiceField(
+ label=_("Colors"),
+ choices=[],
+ required=False,
+ widget=widgets.Select2Multiple,
+ )
+ details_on_color = forms.CharField(label=_("Details on color"), widget=forms.Textarea, required=False)
+ HEADERS["surface"] = FormHeader(_("Dimensions"))
surface = forms.FloatField(
required=False,
widget=widgets.AreaWidget,
- label=_("Total surface (m2)"),
+ label=_("Total surface (m²)"),
validators=[
validators.MinValueValidator(0),
validators.MaxValueValidator(999999999),
],
)
length = forms.FloatField(label=_("Length (m)"), required=False)
+ excavated_length = forms.FloatField(label=_("Excavated length (m)"), required=False)
width = forms.FloatField(label=_("Width (m)"), required=False)
+ excavated_width = forms.FloatField(label=_("Excavated width (m)"), required=False)
thickness = forms.FloatField(label=_("Thickness (m)"), required=False)
diameter = forms.FloatField(label=_("Diameter (m)"), required=False)
depth = forms.FloatField(label=_("Depth (m)"), required=False)
depth_of_appearance = forms.FloatField(
label=_("Depth of appearance (m)"), required=False
)
- opening_date = DateField(label=_("Opening date"), required=False)
- closing_date = DateField(label=_("Closing date"), required=False)
- documentation = forms.MultipleChoiceField(
- label=_("Documentation"),
- choices=[],
- required=False,
- widget=widgets.Select2Multiple,
- )
- location = forms.CharField(
- label=_("Location"),
- widget=forms.Textarea,
- required=False,
- validators=[validators.MaxLengthValidator(200)],
- )
TYPES = [
FieldType("unit", models.Unit),
FieldType("excavation_technic", models.ExcavationTechnicType, is_multiple=True),
FieldType("documentation", models.DocumentationType, is_multiple=True),
FieldType("spatial_reference_system", SpatialReferenceSystem),
+ FieldType("structure", models.StructureType, is_multiple=True),
+ FieldType("texture", models.TextureType, is_multiple=True),
+ FieldType("color", models.ColorType, is_multiple=True),
+ FieldType("inclusion", models.InclusionType, is_multiple=True),
]
def __init__(self, *args, **kwargs):