diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2019-02-14 04:37:25 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2019-04-24 19:38:56 +0200 |
commit | 2e7eb5be6ee91f2cdc799ad87954a8d91685f583 (patch) | |
tree | 9065f87ecad01b977d36c6f2fc2767e76bded3d7 /archaeological_operations/forms.py | |
parent | adf8e75d4e505c5b2430a02390fdb76c3e62b7ff (diff) | |
download | Ishtar-2e7eb5be6ee91f2cdc799ad87954a8d91685f583.tar.bz2 Ishtar-2e7eb5be6ee91f2cdc799ad87954a8d91685f583.zip |
Site form: add localisation fields
Diffstat (limited to 'archaeological_operations/forms.py')
-rw-r--r-- | archaeological_operations/forms.py | 35 |
1 files changed, 30 insertions, 5 deletions
diff --git a/archaeological_operations/forms.py b/archaeological_operations/forms.py index 48fe5c409..3a3c7a4da 100644 --- a/archaeological_operations/forms.py +++ b/archaeological_operations/forms.py @@ -45,7 +45,7 @@ from ishtar_common.forms_common import TownFormSet, get_town_field, TownForm from ishtar_common.models import valid_id, Person, Town, \ DocumentTemplate, Organization, get_current_profile, \ person_type_pks_lazy, person_type_pk_lazy, organization_type_pks_lazy, \ - organization_type_pk_lazy + organization_type_pk_lazy, SpatialReferenceSystem from ishtar_common.wizards import MultiValueDict from widgets import ParcelWidget, SelectParcelWidget, OAWidget @@ -1379,6 +1379,7 @@ class SiteFormSelection(IshtarForm): class SiteForm(CustomForm, ManageOldType): + HEADERS = {} form_label = _(u"General") form_admin_name = _(u"Archaeological site - 010 - General") form_slug = u"archaeological_site-010-general" @@ -1395,6 +1396,10 @@ class SiteForm(CustomForm, ManageOldType): remain = forms.MultipleChoiceField( label=_("Remains"), choices=[], widget=widgets.Select2Multiple, required=False) + collaborator = widgets.Select2MultipleField( + model=Person, label=_("Collaborators"), required=False, remote=True) + comment = forms.CharField(label=_(u"Comment"), widget=forms.Textarea, + required=False) locality_ngi = forms.CharField( label=_(u"National Geographic Institute locality"), widget=forms.Textarea, required=False @@ -1403,13 +1408,33 @@ class SiteForm(CustomForm, ManageOldType): label=_(u"Cadastral locality"), widget=forms.Textarea, required=False ) - collaborator = widgets.Select2MultipleField( - model=Person, label=_("Collaborators"), required=False, remote=True) - comment = forms.CharField(label=_(u"Comment"), widget=forms.Textarea, - required=False) + + HEADERS['x'] = FormHeader(_(u"Coordinates")) + x = forms.FloatField(label=_(u"X"), required=False) + estimated_error_x = forms.FloatField(label=_(u"Estimated error for X"), + required=False) + y = forms.FloatField(label=_(u"Y"), required=False) + estimated_error_y = forms.FloatField(label=_(u"Estimated error for Y"), + required=False) + z = forms.FloatField(label=_(u"Z"), required=False) + estimated_error_z = forms.FloatField(label=_(u"Estimated error for Z"), + required=False) + spatial_reference_system = forms.ChoiceField( + label=_(u"Spatial Reference System"), required=False, choices=[]) + + PROFILE_FILTER = { + 'mapping': [ + 'x', 'get_first_base_find__y', + 'z', 'get_first_base_find__estimated_error_x', + 'estimated_error_y', + 'estimated_error_z', + 'spatial_reference_system' + ], + } TYPES = [ FieldType('period', models.Period, True), FieldType('remain', models.RemainType, True), + FieldType('spatial_reference_system', SpatialReferenceSystem), ] def __init__(self, *args, **kwargs): |