diff options
Diffstat (limited to 'archaeological_operations/forms.py')
-rw-r--r-- | archaeological_operations/forms.py | 48 |
1 files changed, 27 insertions, 21 deletions
diff --git a/archaeological_operations/forms.py b/archaeological_operations/forms.py index c4eef1fc2..98f263ab6 100644 --- a/archaeological_operations/forms.py +++ b/archaeological_operations/forms.py @@ -30,6 +30,7 @@ from django.core import validators from django.db.models import Max from django.forms.formsets import formset_factory, DELETION_FIELD_NAME, \ TOTAL_FORM_COUNT +from django.utils.functional import lazy from django.utils.safestring import mark_safe from ishtar_common.utils import ugettext_lazy as _, pgettext_lazy @@ -46,7 +47,8 @@ from ishtar_common.forms_common import TownFormSet, get_town_field, TownForm from ishtar_common.models import valid_id, valid_ids, Person, Town, \ DocumentTemplate, Organization, get_current_profile, \ person_type_pks_lazy, person_type_pk_lazy, organization_type_pks_lazy, \ - organization_type_pk_lazy, SpatialReferenceSystem, Area + organization_type_pk_lazy, SpatialReferenceSystem, Area, \ + get_sra_agent_label, get_sra_agent_head_scientist_label, get_operator_label from ishtar_common.wizards import MultiValueDict from .widgets import ParcelWidget, SelectParcelWidget, OAWidget @@ -793,7 +795,7 @@ class OperationFormGeneral(CustomForm, ManageOldType): validators=[validators.MinValueValidator(1000), validators.MaxValueValidator(2100)]) old_code = forms.CharField( - label=_(u"Old code"), required=False, + label=_("Old code"), required=False, validators=[validators.MaxLengthValidator(200)]) scientist = forms.IntegerField( label=_("Head scientist"), @@ -802,6 +804,7 @@ class OperationFormGeneral(CustomForm, ManageOldType): 'autocomplete-person', args=[person_type_pks_lazy(['head_scientist', 'sra_agent'])]), associated_model=Person, + tips=lazy(get_sra_agent_head_scientist_label), limit={ 'person_types': (person_type_pk_lazy('head_scientist'), person_type_pk_lazy('sra_agent'))}, @@ -813,6 +816,7 @@ class OperationFormGeneral(CustomForm, ManageOldType): reverse_lazy('autocomplete-organization', args=[organization_type_pk_lazy('operator')]), limit={'organization_type': organization_type_pk_lazy('operator')}, + tips=lazy(get_operator_label), associated_model=Organization, new=True), validators=[valid_id(Organization)], required=False) operator_reference = forms.CharField(label=_(u"Operator reference"), @@ -824,6 +828,7 @@ class OperationFormGeneral(CustomForm, ManageOldType): 'autocomplete-person', args=[person_type_pks_lazy(['sra_agent'])]), associated_model=Person, + tips=lazy(get_sra_agent_label), limit={'person_types': [person_type_pk_lazy('sra_agent')]}, new=True), validators=[valid_id(Person)], required=False) @@ -840,11 +845,11 @@ class OperationFormGeneral(CustomForm, ManageOldType): report_processing = forms.ChoiceField(label=_(u"Report processing"), choices=[], required=False) if settings.COUNTRY == 'fr': - cira_date = DateField(label=u"Date avis CIRA", required=False) + cira_date = DateField(label="Date avis CTRA/CIRA", required=False) negative_result = forms.NullBooleanField( - required=False, label=u"Résultat considéré comme négatif") + required=False, label="Résultat considéré comme négatif") cira_rapporteur = forms.IntegerField( - label=u"Rapporteur CIRA", + label="Rapporteur CTRA/CIRA", widget=widgets.JQueryAutoComplete( reverse_lazy( 'autocomplete-person', @@ -853,41 +858,42 @@ class OperationFormGeneral(CustomForm, ManageOldType): limit={'person_types': [ person_type_pk_lazy('sra_agent'), person_type_pk_lazy('head_scientist')]}, + tips=lazy(get_sra_agent_head_scientist_label), associated_model=Person, new=True), validators=[valid_id(Person)], required=False) documentation_deadline = DateField( - label=_(u"Deadline for submission of the documentation"), + label=_("Deadline for submission of the documentation"), required=False) documentation_received = forms.NullBooleanField( - required=False, label=_(u"Documentation received")) + required=False, label=_("Documentation received")) finds_deadline = DateField( - label=_(u"Deadline for submission of the finds"), required=False, + label=_("Deadline for submission of the finds"), required=False, ) finds_received = forms.NullBooleanField( - required=False, label=_(u"Finds received")) + required=False, label=_("Finds received")) - comment = forms.CharField(label=_(u"Comment"), widget=forms.Textarea, + comment = forms.CharField(label=_("Comment"), widget=forms.Textarea, required=False) scientific_documentation_comment = forms.CharField( - label=_(u"Comment about scientific documentation"), + label=_("Comment about scientific documentation"), widget=forms.Textarea, required=False) - record_quality_type = forms.ChoiceField(label=_(u"Record quality"), + record_quality_type = forms.ChoiceField(label=_("Record quality"), required=False) virtual_operation = forms.BooleanField(required=False, - label=_(u"Virtual operation")) + label=_("Virtual operation")) - HEADERS['x'] = FormHeader(_(u"Coordinates")) - x = forms.FloatField(label=_(u"X"), required=False) - estimated_error_x = forms.FloatField(label=_(u"Estimated error for X"), + HEADERS['x'] = FormHeader(_("Coordinates")) + x = forms.FloatField(label=_("X"), required=False) + estimated_error_x = forms.FloatField(label=_("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"), + y = forms.FloatField(label=_("Y"), required=False) + estimated_error_y = forms.FloatField(label=_("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"), + z = forms.FloatField(label=_("Z"), required=False) + estimated_error_z = forms.FloatField(label=_("Estimated error for Z"), required=False) spatial_reference_system = forms.ChoiceField( - label=_(u"Spatial Reference System"), required=False, choices=[]) + label=_("Spatial Reference System"), required=False, choices=[]) FILE_FIELDS = [ 'report_delivery_date', |