diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-03-21 23:00:22 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-03-21 23:00:22 +0100 |
commit | abe0902d8c88b1e1acc7a1bff666109f5d18cfe8 (patch) | |
tree | 10c6e18b782650e66684b0527adbe768875aed08 /archaeological_context_records/forms.py | |
parent | f7a4bd783df87aea052aba07b2a48001b6389772 (diff) | |
download | Ishtar-abe0902d8c88b1e1acc7a1bff666109f5d18cfe8.tar.bz2 Ishtar-abe0902d8c88b1e1acc7a1bff666109f5d18cfe8.zip |
Context records forms/sheet: add documentation types, diameter and depth of appearance (refs #3561)
Diffstat (limited to 'archaeological_context_records/forms.py')
-rw-r--r-- | archaeological_context_records/forms.py | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/archaeological_context_records/forms.py b/archaeological_context_records/forms.py index ef17e561e..522c69deb 100644 --- a/archaeological_context_records/forms.py +++ b/archaeological_context_records/forms.py @@ -130,8 +130,11 @@ class RecordFormSelection(forms.Form): class RecordFormGeneral(ManageOldType, forms.Form): form_label = _("General") file_upload = True - associated_models = {'parcel': Parcel, 'unit': models.Unit, - 'excavation_technic': models.ExcavationTechnicType} + base_models = ["documentation"] + associated_models = { + 'parcel': Parcel, 'unit': models.Unit, + 'documentation': models.DocumentationType, + 'excavation_technic': models.ExcavationTechnicType} pk = forms.IntegerField(required=False, widget=forms.HiddenInput) operation_id = forms.IntegerField(widget=forms.HiddenInput) parcel = forms.ChoiceField(label=_("Parcel"), choices=[]) @@ -146,10 +149,15 @@ class RecordFormGeneral(ManageOldType, forms.Form): length = forms.FloatField(label=_(u"Length (m)"), required=False) width = forms.FloatField(label=_(u"Width (m)"), required=False) thickness = forms.FloatField(label=_(u"Thickness (m)"), required=False) + diameter = forms.FloatField(label=_(u"Diameter (m)"), required=False) depth = forms.FloatField(label=_(u"Depth (m)"), required=False) - unit = forms.ChoiceField(label=_("Context record type"), required=False, choices=[]) - has_furniture = forms.NullBooleanField(label=_(u"Has furniture?"), - required=False) + depth_of_appearance = forms.FloatField( + label=_(u"Depth of appearance (m)"), required=False) + unit = forms.ChoiceField(label=_(u"Context record type"), required=False, + choices=[]) + documentation = forms.MultipleChoiceField( + label=_("Documentation"), choices=[], required=False, + widget=forms.CheckboxSelectMultiple) location = forms.CharField( label=_(u"Location"), widget=forms.Textarea, required=False, validators=[validators.MaxLengthValidator(200)]) @@ -216,6 +224,11 @@ class RecordFormGeneral(ManageOldType, forms.Form): initial=self.init_data.get('excavation_technic')) self.fields['excavation_technic'].help_text = \ models.ExcavationTechnicType.get_help() + self.fields['documentation'].choices = \ + models.DocumentationType.get_types(empty_first=False, + initial=self.init_data.get('documentation')) + self.fields['documentation'].help_text = \ + models.DocumentationType.get_help() def clean(self): # manage unique context record ID |