diff options
Diffstat (limited to 'archaeological_operations/forms.py')
-rw-r--r-- | archaeological_operations/forms.py | 424 |
1 files changed, 212 insertions, 212 deletions
diff --git a/archaeological_operations/forms.py b/archaeological_operations/forms.py index 3714b2e6a..b54a081d8 100644 --- a/archaeological_operations/forms.py +++ b/archaeological_operations/forms.py @@ -60,7 +60,7 @@ class ParcelField(forms.MultiValueField): super(ParcelField, self).__init__(*args, **kwargs) def compress(self, data_list): - return u"-".join(data_list) + return "-".join(data_list) class ParcelForm(IshtarForm): @@ -73,12 +73,12 @@ class ParcelForm(IshtarForm): year = forms.IntegerField(label=_("Year"), required=False, validators=[validators.MinValueValidator(1000), validators.MaxValueValidator(2100)]) - section = forms.CharField(label=_(u"Section"), required=False, + section = forms.CharField(label=_("Section"), required=False, validators=[validators.MaxLengthValidator(4)]) parcel_number = forms.CharField( - label=_(u"Parcel number"), required=False, + label=_("Parcel number"), required=False, validators=[validators.MaxLengthValidator(6)]) - public_domain = forms.BooleanField(label=_(u"Public domain"), + public_domain = forms.BooleanField(label=_("Public domain"), initial=False, required=False) def __init__(self, *args, **kwargs): @@ -122,7 +122,7 @@ class ParcelForm(IshtarForm): not self.cleaned_data.get('public_domain'): return {} if not self.cleaned_data.get('town'): - raise forms.ValidationError(_(u"Town section is required.")) + raise forms.ValidationError(_("Town section is required.")) return self.cleaned_data @classmethod @@ -193,10 +193,10 @@ class ParcelForm(IshtarForm): res += " ; " res += town + u' : ' if c_section: - res += u" / " + res += " / " c_section = section res += section + u' ' - res += u", ".join(parcel_numbers) + res += ", ".join(parcel_numbers) if year: res += " (%s)" % str(year) return res @@ -206,10 +206,10 @@ class ParcelSelectionForm(IshtarForm): _town = forms.ChoiceField(label=_("Town"), choices=(), required=False, validators=[valid_id(models.Town)]) _parcel_selection = forms.CharField( - label=_(u"Full text input"), + label=_("Full text input"), widget=SelectParcelWidget(attrs={'class': 'parcel-select'}), - help_text=_(u"example: \"2013: XD:1 to 13,24,33 to 39, YD:24\" or " - u"\"AB:24,AC:42\""), + help_text=_("example: \"2013: XD:1 to 13,24,33 to 39, YD:24\" or " + "\"AB:24,AC:42\""), max_length=100, required=False) @@ -373,10 +373,10 @@ class RecordRelationsForm(ManageOldType): current_related_model = models.Operation associated_models = {'right_record': models.Operation, 'relation_type': models.RelationType} - relation_type = forms.ChoiceField(label=_(u"Relation type"), + relation_type = forms.ChoiceField(label=_("Relation type"), choices=[], required=False) right_record = forms.IntegerField( - label=_(u"Operation"), + label=_("Operation"), widget=widgets.JQueryAutoComplete( reverse_lazy('autocomplete-operation'), associated_model=models.Operation), @@ -398,8 +398,8 @@ class RecordRelationsForm(ManageOldType): if not nc or nc[-1][0] != rel: nc.append([rel, []]) nc[-1][1].append(ope) - rendered = u";".join( - [u"{}{} {}".format(rel, _(u":"), u" ; ".join(opes)) + rendered = ";".join( + ["{}{} {}".format(rel, _(":"), " ; ".join(opes)) for rel, opes in nc]) return rendered @@ -407,16 +407,16 @@ class RecordRelationsForm(ManageOldType): cleaned_data = self.cleaned_data if (cleaned_data.get('relation_type', None) and not cleaned_data.get('right_record', None)): - raise forms.ValidationError(_(u"You should select an operation.")) + raise forms.ValidationError(_("You should select an operation.")) if (not cleaned_data.get('relation_type', None) and cleaned_data.get('right_record', None)): raise forms.ValidationError( - _(u"You should select a relation type.")) + _("You should select a relation type.")) if self.left_record and \ str(cleaned_data.get('right_record', None)) == str( self.left_record.pk): raise forms.ValidationError( - _(u"An operation cannot be related to herself.")) + _("An operation cannot be related to herself.")) return cleaned_data @classmethod @@ -448,7 +448,7 @@ class RecordRelationsForm(ManageOldType): nc[-1][1].append(ope) result.append((_("Current relations"), cls._format_lst(current))) if deleted: - result.append((_("Deleted relations"), u" ; ".join(deleted))) + result.append((_("Deleted relations"), " ; ".join(deleted))) return result @@ -472,37 +472,37 @@ class RecordRelationsFormSetBase(FormSet): RecordRelationsFormSet = formset_factory( RecordRelationsForm, can_delete=True, formset=RecordRelationsFormSetBase) -RecordRelationsFormSet.form_label = _(u"Relations") -RecordRelationsFormSet.form_admin_name = _(u"Operation - 080 - Relations") +RecordRelationsFormSet.form_label = _("Relations") +RecordRelationsFormSet.form_admin_name = _("Operation - 080 - Relations") RecordRelationsFormSet.form_slug = "operation-080-relations" class OperationSelect(DocumentItemSelect): _model = models.Operation - form_admin_name = _(u"Operation - 001 - Search") + form_admin_name = _("Operation - 001 - Search") form_slug = "operation-001-search" search_vector = forms.CharField( - label=_(u"Full text search"), widget=widgets.SearchWidget( + label=_("Full text search"), widget=widgets.SearchWidget( 'archaeological-operations', 'operation')) year = forms.IntegerField(label=_("Year")) - operation_code = forms.IntegerField(label=_(u"Numeric reference")) + operation_code = forms.IntegerField(label=_("Numeric reference")) code_patriarche = forms.CharField( max_length=500, widget=OAWidget, label="Code PATRIARCHE") drassm_code = forms.CharField( - label=_(u"DRASSM code"), required=False, max_length=100) + label=_("DRASSM code"), required=False, max_length=100) towns = get_town_field() towns__areas = forms.ChoiceField(label=_("Areas"), choices=[]) - parcel = forms.CharField(label=_(u"Parcel")) + parcel = forms.CharField(label=_("Parcel")) if settings.ISHTAR_DPTS: towns__numero_insee__startswith = forms.ChoiceField( - label=_(u"Department"), choices=[]) - common_name = forms.CharField(label=_(u"Name"), max_length=30) - address = forms.CharField(label=_(u"Address / Locality"), max_length=100) - operation_type = forms.ChoiceField(label=_(u"Operation type"), choices=[]) - end_date = forms.NullBooleanField(label=_(u"Is open?")) + label=_("Department"), choices=[]) + common_name = forms.CharField(label=_("Name"), max_length=30) + address = forms.CharField(label=_("Address / Locality"), max_length=100) + operation_type = forms.ChoiceField(label=_("Operation type"), choices=[]) + end_date = forms.NullBooleanField(label=_("Is open?")) in_charge = forms.IntegerField( widget=widgets.JQueryAutoComplete( reverse_lazy( @@ -510,14 +510,14 @@ class OperationSelect(DocumentItemSelect): args=[person_type_pks_lazy(['sra_agent'])] ), associated_model=Person), - label=_(u"In charge")) + label=_("In charge")) scientist = forms.IntegerField( widget=widgets.JQueryAutoComplete( reverse_lazy( 'autocomplete-person-permissive', args=[person_type_pks_lazy(['sra_agent', 'head_scientist'])]), associated_model=Person), - label=_(u"Scientist in charge")) + label=_("Scientist in charge")) operator = forms.IntegerField( label=_("Operator"), widget=widgets.JQueryAutoComplete( @@ -526,24 +526,24 @@ class OperationSelect(DocumentItemSelect): args=[organization_type_pks_lazy(['operator'])]), associated_model=Organization), validators=[valid_id(Organization)]) - # operator_reference = forms.CharField(label=_(u"Operator reference"), + # operator_reference = forms.CharField(label=_("Operator reference"), # max_length=20) - remains = forms.ChoiceField(label=_(u"Remains"), choices=[]) - periods = forms.ChoiceField(label=_(u"Periods"), choices=[]) - start_before = DateField(label=_(u"Started before")) - start_after = DateField(label=_(u"Started after")) - end_before = DateField(label=_(u"Ended before")) - end_after = DateField(label=_(u"Ended after")) + remains = forms.ChoiceField(label=_("Remains"), choices=[]) + periods = forms.ChoiceField(label=_("Periods"), choices=[]) + start_before = DateField(label=_("Started before")) + start_after = DateField(label=_("Started after")) + end_before = DateField(label=_("Ended before")) + end_after = DateField(label=_("Ended after")) relation_types = forms.ChoiceField( - label=_(u"Search within relations"), choices=[]) - comment = forms.CharField(label=_(u"Comment"), max_length=500) - abstract = forms.CharField(label=_(u"Abstract (full text search)")) + label=_("Search within relations"), choices=[]) + comment = forms.CharField(label=_("Comment"), max_length=500) + abstract = forms.CharField(label=_("Abstract (full text search)")) scientific_documentation_comment = forms.CharField( - label=_(u"Comment about scientific documentation")) - record_quality_type = forms.ChoiceField(label=_(u"Record quality")) - report_processing = forms.ChoiceField(label=_(u"Report processing"), + label=_("Comment about scientific documentation")) + record_quality_type = forms.ChoiceField(label=_("Record quality")) + report_processing = forms.ChoiceField(label=_("Report processing"), choices=[]) - virtual_operation = forms.NullBooleanField(label=_(u"Virtual operation")) + virtual_operation = forms.NullBooleanField(label=_("Virtual operation")) archaeological_sites = forms.IntegerField( label=_("Archaeological site"), widget=widgets.JQueryAutoComplete( @@ -551,31 +551,31 @@ class OperationSelect(DocumentItemSelect): associated_model=models.ArchaeologicalSite), validators=[valid_id(models.ArchaeologicalSite)]) history_creator = forms.IntegerField( - label=_(u"Created by"), + label=_("Created by"), widget=widgets.JQueryAutoComplete( reverse_lazy('autocomplete-person', args=['0', 'user']), associated_model=Person), validators=[valid_id(Person)]) history_modifier = forms.IntegerField( - label=_(u"Modified by"), + label=_("Modified by"), widget=widgets.JQueryAutoComplete( reverse_lazy('autocomplete-person', args=['0', 'user']), associated_model=Person), validators=[valid_id(Person)]) documentation_received = forms.NullBooleanField( - label=_(u"Documentation received")) + label=_("Documentation received")) documentation_deadline_before = DateField( - label=_(u"Documentation deadline before")) + label=_("Documentation deadline before")) documentation_deadline_after = DateField( - label=_(u"Documentation deadline after")) + label=_("Documentation deadline after")) has_finds = forms.NullBooleanField(label=_("Has finds")) finds_received = forms.NullBooleanField( - label=_(u"Finds received")) + label=_("Finds received")) finds_deadline_before = DateField( - label=_(u"Finds deadline before")) + label=_("Finds deadline before")) finds_deadline_after = DateField( - label=_(u"Finds deadline after")) + label=_("Finds deadline after")) TYPES = [ FieldType('operation_type', models.OperationType), @@ -608,7 +608,7 @@ class OperationSelect(DocumentItemSelect): class OperationFormSelection(LockForm, CustomFormSearch): SEARCH_AND_SELECT = True - form_label = _(u"Operation search") + form_label = _("Operation search") associated_models = {'pk': models.Operation} extra_form_modals = ["person", "organization"] currents = {'pk': models.Operation} @@ -622,7 +622,7 @@ class OperationFormSelection(LockForm, CustomFormSearch): class OperationFormMultiSelection(LockForm, MultiSearchForm): - form_label = _(u"Operation search") + form_label = _("Operation search") associated_models = {'pks': models.Operation} extra_form_modals = ["person", "organization"] pk_key = 'pks' @@ -642,7 +642,7 @@ class OperationCodeInput(forms.TextInput): name, value = args base_name = '-'.join(name.split('-')[:-1]) rendered = super(OperationCodeInput, self).render(*args, **kwargs) - js = u"""\n <script type="text/javascript"><!--// + js = """\n <script type="text/javascript"><!--// function initialyse_operation_code () { // if the form is in creation mode if(!$("#id_%(base_name)s-pk").val()){ @@ -663,33 +663,33 @@ class OperationCodeInput(forms.TextInput): class OperationFormFileChoice(IshtarForm): - form_label = _(u"Associated file") + form_label = _("Associated file") associated_models = {'associated_file': File, } currents = {'associated_file': File} associated_file = forms.IntegerField( - label=_(u"Archaeological file"), + label=_("Archaeological file"), widget=widgets.JQueryAutoComplete( reverse_lazy('autocomplete-file'), associated_model=File), validators=[valid_id(File)], required=False) class OperationFormAbstract(CustomForm, IshtarForm): - form_label = _(u"Abstract") - form_admin_name = _(u"Operation - 090 - Abstract") + form_label = _("Abstract") + form_admin_name = _("Operation - 090 - Abstract") form_slug = "operation-090-abstract" abstract = forms.CharField( - label=_(u"Abstract"), + label=_("Abstract"), widget=forms.Textarea(attrs={'class': 'xlarge'}), required=False) -SLICING = (("month", _(u"months")), ('year', _(u"years")),) +SLICING = (("month", _("months")), ('year', _("years")),) -DATE_SOURCE = (('creation', _(u"Creation date")), - ("start", _(u"Start of field work"))) +DATE_SOURCE = (('creation', _("Creation date")), + ("start", _("Start of field work"))) PREVENTIVE_RESARCH = (('all', _('All')), - ('preventive', _(u"Preventive")), - ('research', _(u"Research")),) + ('preventive', _("Preventive")), + ('research', _("Research")),) class DashboardForm(IshtarForm): @@ -706,8 +706,8 @@ class DashboardForm(IshtarForm): required=False) operator = forms.ChoiceField(label=_("Operator"), choices=[], required=False) - after = DateField(label=_(u"Date after"), required=False) - before = DateField(label=_(u"Date before"), required=False) + after = DateField(label=_("Date after"), required=False) + before = DateField(label=_("Date before"), required=False) with_report = forms.BooleanField(label=_("With reports"), required=False) with_finds = forms.BooleanField(label=_("With finds"), required=False) @@ -762,8 +762,8 @@ class DashboardForm(IshtarForm): class OperationFormGeneral(CustomForm, ManageOldType): HEADERS = {} - form_label = _(u"General") - form_admin_name = _(u"Operation - 010 - General") + form_label = _("General") + form_admin_name = _("Operation - 010 - General") form_slug = "operation-010-general" extra_form_modals = ["person", "organization"] @@ -779,19 +779,19 @@ class OperationFormGeneral(CustomForm, ManageOldType): 'spatial_reference_system': SpatialReferenceSystem, } pk = forms.IntegerField(required=False, widget=forms.HiddenInput) - code_patriarche = forms.CharField(label=u"Code PATRIARCHE", + code_patriarche = forms.CharField(label="Code PATRIARCHE", max_length=500, widget=OAWidget, required=False) drassm_code = forms.CharField( - label=_(u"DRASSM code"), required=False, max_length=100) - operation_type = forms.ChoiceField(label=_(u"Operation type"), + label=_("DRASSM code"), required=False, max_length=100) + operation_type = forms.ChoiceField(label=_("Operation type"), choices=[]) - common_name = forms.CharField(label=_(u"Generic name"), required=False, + common_name = forms.CharField(label=_("Generic name"), required=False, max_length=500, widget=forms.Textarea) - address = forms.CharField(label=_(u"Address / Locality"), required=False, + address = forms.CharField(label=_("Address / Locality"), required=False, max_length=500, widget=forms.Textarea) - year = forms.IntegerField(label=_(u"Year"), + year = forms.IntegerField(label=_("Year"), initial=lambda: datetime.datetime.now().year, validators=[validators.MinValueValidator(1000), validators.MaxValueValidator(2100)]) @@ -820,7 +820,7 @@ class OperationFormGeneral(CustomForm, ManageOldType): tips=lazy(get_operator_label), associated_model=Organization, new=True), validators=[valid_id(Organization)], required=False) - operator_reference = forms.CharField(label=_(u"Operator reference"), + operator_reference = forms.CharField(label=_("Operator reference"), required=False, max_length=20) in_charge = forms.IntegerField( label=_("In charge"), @@ -838,12 +838,12 @@ class OperationFormGeneral(CustomForm, ManageOldType): label=_("Total surface (m2)"), validators=[validators.MinValueValidator(0), validators.MaxValueValidator(999999999)]) - start_date = DateField(label=_(u"Start date"), required=False) - excavation_end_date = DateField(label=_(u"Excavation end date"), + start_date = DateField(label=_("Start date"), required=False) + excavation_end_date = DateField(label=_("Excavation end date"), required=False) - report_delivery_date = DateField(label=_(u"Report delivery date"), + report_delivery_date = DateField(label=_("Report delivery date"), required=False) - report_processing = forms.ChoiceField(label=_(u"Report processing"), + report_processing = forms.ChoiceField(label=_("Report processing"), choices=[], required=False) if settings.COUNTRY == 'fr': cira_date = DateField(label="Date avis CTRA/CIRA", required=False) @@ -947,13 +947,13 @@ class OperationFormGeneral(CustomForm, ManageOldType): and cleaned_data.get('excavation_end_date', None): if not cleaned_data.get('start_date', None): raise forms.ValidationError( - _(u"If you want to set an excavation end date you " - u"have to provide a start date.")) + _("If you want to set an excavation end date you " + "have to provide a start date.")) if cleaned_data['excavation_end_date'] \ < cleaned_data['start_date']: raise forms.ValidationError( - _(u"The excavation end date cannot be before the start " - u"date.")) + _("The excavation end date cannot be before the start " + "date.")) # verify patriarche code_p = self.cleaned_data.get('code_patriarche', None) @@ -963,8 +963,8 @@ class OperationFormGeneral(CustomForm, ManageOldType): if 'pk' in cleaned_data and cleaned_data['pk']: ops = ops.exclude(pk=cleaned_data['pk']) if ops.count(): - msg = u"Ce code OA a déjà été affecté à une "\ - u"autre opération" + msg = "Ce code OA a déjà été affecté à une "\ + "autre opération" raise forms.ValidationError(msg) # manage unique operation ID @@ -982,21 +982,21 @@ class OperationFormGeneral(CustomForm, ManageOldType): Max('operation_code'))["operation_code__max"] if year and max_val: msg = _( - u"Operation code already exists for year: %(year)d - use a " - u"value bigger than %(last_val)d") % { + "Operation code already exists for year: %(year)d - use a " + "value bigger than %(last_val)d") % { 'year': year, 'last_val': max_val} else: - msg = _(u"Bad operation code") + msg = _("Bad operation code") raise forms.ValidationError(msg) return self.cleaned_data class OperationFormModifGeneral(OperationFormGeneral): - operation_code = forms.IntegerField(label=_(u"Operation code"), + operation_code = forms.IntegerField(label=_("Operation code"), required=False) currents = {'associated_file': File} associated_file = forms.IntegerField( - label=_(u"Archaeological file"), + label=_("Archaeological file"), widget=widgets.JQueryAutoComplete( reverse_lazy('autocomplete-file'), associated_model=File), @@ -1038,16 +1038,16 @@ class CourtOrderedSeizureForm(CustomForm, IshtarForm): } seizure_name = forms.CharField( - label=_(u"Seizure name"), required=False, + label=_("Seizure name"), required=False, ) official_report_number = forms.CharField( - label=_(u"Official report number"), required=False, + label=_("Official report number"), required=False, ) protagonist = forms.IntegerField( widget=widgets.JQueryAutoComplete( reverse_lazy('autocomplete-person-permissive'), associated_model=Person, new=True), - label=_(u"Protagonist"), required=False, + label=_("Protagonist"), required=False, ) applicant_authority = forms.IntegerField( widget=widgets.JQueryAutoComplete( @@ -1064,8 +1064,8 @@ class CourtOrderedSeizureForm(CustomForm, IshtarForm): class CollaboratorForm(CustomForm, IshtarForm): - form_label = _(u"Collaborators") - form_admin_name = _(u"Operation - 020 - Collaborators") + form_label = _("Collaborators") + form_admin_name = _("Operation - 020 - Collaborators") form_slug = "operation-020-collaborators" base_models = ['collaborator'] @@ -1080,37 +1080,37 @@ class CollaboratorForm(CustomForm, IshtarForm): class OperationFormPreventive(CustomForm, IshtarForm): - form_label = _(u"Preventive informations - excavation") - form_admin_name = _(u"Operation - 033 - Preventive - Excavation") + form_label = _("Preventive informations - excavation") + form_admin_name = _("Operation - 033 - Preventive - Excavation") form_slug = "operation-033-preventive-excavation" - cost = forms.IntegerField(label=_(u"Cost (euros)"), required=False) - scheduled_man_days = forms.IntegerField(label=_(u"Scheduled man-days"), + cost = forms.IntegerField(label=_("Cost (euros)"), required=False) + scheduled_man_days = forms.IntegerField(label=_("Scheduled man-days"), required=False) - optional_man_days = forms.IntegerField(label=_(u"Optional man-days"), + optional_man_days = forms.IntegerField(label=_("Optional man-days"), required=False) - effective_man_days = forms.IntegerField(label=_(u"Effective man-days"), + effective_man_days = forms.IntegerField(label=_("Effective man-days"), required=False) if settings.COUNTRY == 'fr': fnap_financing = forms.FloatField( - required=False, label=u"Pourcentage de financement FNAP", + required=False, label="Pourcentage de financement FNAP", validators=[validators.MinValueValidator(0), validators.MaxValueValidator(100)]) class OperationFormPreventiveDiag(CustomForm, IshtarForm): form_label = _("Preventive informations - diagnostic") - form_admin_name = _(u"Operation - 037 - Preventive - Diagnostic") + form_admin_name = _("Operation - 037 - Preventive - Diagnostic") form_slug = "operation-037-preventive-diagnostic" if settings.COUNTRY == 'fr': zoning_prescription = forms.NullBooleanField( - required=False, label=_(u"Prescription on zoning")) + required=False, label=_("Prescription on zoning")) large_area_prescription = forms.NullBooleanField( - required=False, label=_(u"Prescription on large area")) + required=False, label=_("Prescription on large area")) geoarchaeological_context_prescription = forms.NullBooleanField( required=False, - label=_(u"Prescription on geoarchaeological context")) + label=_("Prescription on geoarchaeological context")) class SelectedTownForm(IshtarForm): @@ -1130,13 +1130,13 @@ class SelectedTownForm(IshtarForm): SelectedTownFormset = formset_factory(SelectedTownForm, can_delete=True, formset=TownFormSet) -SelectedTownFormset.form_label = _(u"Towns") -SelectedTownFormset.form_admin_name = _(u"Operation - 040 - Towns") +SelectedTownFormset.form_label = _("Towns") +SelectedTownFormset.form_admin_name = _("Operation - 040 - Towns") SelectedTownFormset.form_slug = "operation-040-towns" TownFormset = formset_factory(TownForm, can_delete=True, formset=TownFormSet) TownFormset.form_label = _("Towns") -TownFormset.form_admin_name = _(u"Operation - 040 - Towns (2)") +TownFormset.form_admin_name = _("Operation - 040 - Towns (2)") TownFormset.form_slug = "operation-040-towns-2" @@ -1158,14 +1158,14 @@ class SelectedParcelForm(IshtarForm): SelectedParcelFormSet = formset_factory(SelectedParcelForm, can_delete=True, formset=ParcelFormSet) SelectedParcelFormSet.form_label = _("Parcels") -SelectedParcelFormSet.form_admin_name = _(u"Operation - 050 - Parcels") +SelectedParcelFormSet.form_admin_name = _("Operation - 050 - Parcels") SelectedParcelFormSet.form_slug = "operation-050-parcels" SelectedParcelGeneralFormSet = formset_factory(ParcelForm, can_delete=True, formset=ParcelFormSet) SelectedParcelGeneralFormSet.form_label = _("Parcels") SelectedParcelGeneralFormSet.form_admin_name = _( - u"Operation - 050 - Parcels (2)") + "Operation - 050 - Parcels (2)") SelectedParcelGeneralFormSet.form_slug = "operation-050-parcels-2" """ @@ -1195,14 +1195,14 @@ class SelectedParcelFormSet(forms.Form): class RemainForm(CustomForm, ManageOldType, forms.Form): - form_label = _(u"Remain types") - form_admin_name = _(u"Operation - 060 - Remains") + form_label = _("Remain types") + form_admin_name = _("Operation - 060 - Remains") form_slug = "operation-060-remains" base_model = 'remain' associated_models = {'remain': models.RemainType} remain = widgets.Select2MultipleField( - label=_(u"Remain type"), required=False + label=_("Remain type"), required=False ) TYPES = [ @@ -1211,14 +1211,14 @@ class RemainForm(CustomForm, ManageOldType, forms.Form): class PeriodForm(CustomForm, ManageOldType, forms.Form): - form_label = _(u"Periods") - form_admin_name = _(u"Operation - 070 - Periods") + form_label = _("Periods") + form_admin_name = _("Operation - 070 - Periods") form_slug = "operation-070-periods" base_model = 'period' associated_models = {'period': models.Period} period = widgets.Select2MultipleField( - label=_(u"Period"), required=False + label=_("Period"), required=False ) TYPES = [ @@ -1231,9 +1231,9 @@ class ArchaeologicalSiteForm(ManageOldType): 'cultural_attribution': models.CulturalAttributionType, 'spatial_reference_system': SpatialReferenceSystem} HEADERS = {} - reference = forms.CharField(label=_(u"Reference"), max_length=200) - name = forms.CharField(label=_(u"Name"), max_length=200, required=False) - other_reference = forms.CharField(label=_(u"Other reference"), + reference = forms.CharField(label=_("Reference"), max_length=200) + name = forms.CharField(label=_("Name"), max_length=200, required=False) + other_reference = forms.CharField(label=_("Other reference"), required=False) periods = forms.MultipleChoiceField( label=_("Periods"), choices=[], widget=widgets.Select2Multiple, @@ -1245,18 +1245,18 @@ class ArchaeologicalSiteForm(ManageOldType): label=_("Cultural attributions"), choices=[], widget=widgets.Select2Multiple, 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"), + 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=[]) PROFILE_FILTER = { 'mapping': [ @@ -1287,7 +1287,7 @@ class ArchaeologicalSiteForm(ManageOldType): reference = self.cleaned_data['reference'] if models.ArchaeologicalSite.objects\ .filter(reference=reference).count(): - raise forms.ValidationError(_(u"This reference already exists.")) + raise forms.ValidationError(_("This reference already exists.")) return reference def save(self, user): @@ -1345,9 +1345,9 @@ class ArchaeologicalSiteBasicForm(widgets.Select2Media, IshtarForm): ArchaeologicalSiteFormSet = formset_factory( ArchaeologicalSiteBasicForm, can_delete=True, formset=FormSet) -ArchaeologicalSiteFormSet.form_label = _(u"Archaeological sites") +ArchaeologicalSiteFormSet.form_label = _("Archaeological sites") ArchaeologicalSiteFormSet.form_admin_name = _( - u"Operation - 030 - Archaeological sites") + "Operation - 030 - Archaeological sites") ArchaeologicalSiteFormSet.form_slug = "operation-030-archaeological-sites" ArchaeologicalSiteFormSet.extra_form_modals = ["archaeologicalsite"] @@ -1360,17 +1360,17 @@ class ArchaeologicalSiteSelectionForm(IshtarForm): reverse_lazy('autocomplete-archaeologicalsite'), associated_model=models.ArchaeologicalSite, new=True, multiple=True), - label=_(u"Search")) + label=_("Search")) class FinalOperationClosingForm(FinalForm): confirm_msg = " " - confirm_end_msg = _(u"Would you like to close this operation?") + confirm_end_msg = _("Would you like to close this operation?") class OperationDeletionForm(FinalForm): confirm_msg = " " - confirm_end_msg = _(u"Would you like to delete this operation?") + confirm_end_msg = _("Would you like to delete this operation?") ######### # Sites # @@ -1379,60 +1379,60 @@ class OperationDeletionForm(FinalForm): class SiteSelect(DocumentItemSelect): _model = models.ArchaeologicalSite - form_admin_name = _(u"Archaeological site - 001 - Search") + form_admin_name = _("Archaeological site - 001 - Search") form_slug = "archaeological_site-001-search" search_vector = forms.CharField( - label=_(u"Full text search"), widget=widgets.SearchWidget( + label=_("Full text search"), widget=widgets.SearchWidget( 'archaeological-operations', 'site')) - reference = forms.CharField(label=_(u"Reference"), max_length=200, + reference = forms.CharField(label=_("Reference"), max_length=200, required=False) - name = forms.CharField(label=_(u"Name"), max_length=200, required=False) + name = forms.CharField(label=_("Name"), max_length=200, required=False) other_reference = forms.CharField(label=_("Other reference"), max_length=200, required=False) - periods = forms.ChoiceField(label=_(u"Periods"), choices=[], required=False) - remains = forms.ChoiceField(label=_(u"Remains"), choices=[], required=False) + periods = forms.ChoiceField(label=_("Periods"), choices=[], required=False) + remains = forms.ChoiceField(label=_("Remains"), choices=[], required=False) cultural_attributions = forms.ChoiceField( label=_("Cultural attribution"), choices=[], required=False) towns = get_town_field() towns__areas = forms.ChoiceField(label=_("Areas"), choices=[]) - comment = forms.CharField(label=_(u"Comment"), max_length=200, + comment = forms.CharField(label=_("Comment"), max_length=200, required=False) top_operation = forms.IntegerField( - label=_(u"Top operation"), required=False, + label=_("Top operation"), required=False, widget=widgets.JQueryAutoComplete( reverse_lazy('autocomplete-operation'), associated_model=models.Operation), validators=[valid_id(models.Operation)]) operation = forms.IntegerField( - label=_(u"Operation"), required=False, + label=_("Operation"), required=False, widget=widgets.JQueryAutoComplete( reverse_lazy('autocomplete-operation'), associated_model=models.Operation), validators=[valid_id(models.Operation)]) locality_ngi = forms.CharField( - label=_(u"National Geographic Institute locality"), max_length=200, + label=_("National Geographic Institute locality"), max_length=200, required=False) locality_cadastral = forms.CharField( - label=_(u"Cadastral locality"), max_length=200, + label=_("Cadastral locality"), max_length=200, required=False) affmar_number = forms.CharField( - label=_(u"AffMar number"), required=False, max_length=100) + label=_("AffMar number"), required=False, max_length=100) drassm_number = forms.CharField( - label=_(u"DRASSM number"), required=False, max_length=100) + label=_("DRASSM number"), required=False, max_length=100) shipwreck_name = forms.CharField( - label=_(u"Shipwreck name"), max_length=200, + label=_("Shipwreck name"), max_length=200, required=False) oceanographic_service_localisation = forms.CharField( - label=_(u"Oceanographic service localisation"), max_length=200, + label=_("Oceanographic service localisation"), max_length=200, required=False) shipwreck_code = forms.CharField( - label=_(u"Shipwreck code"), max_length=200, + label=_("Shipwreck code"), max_length=200, required=False) - sinking_date = DateField(label=_(u"Sinking date"), required=False) + sinking_date = DateField(label=_("Sinking date"), required=False) discovery_area = forms.CharField( - label=_(u"Discovery area"), max_length=200, + label=_("Discovery area"), max_length=200, required=False) TYPES = [ FieldType('periods', models.Period), @@ -1491,9 +1491,9 @@ class SiteFormMultiSelection(LockForm, MultiSearchForm): class SiteForm(CustomForm, ManageOldType): HEADERS = {} - form_label = _(u"General") - form_admin_name = _(u"Archaeological site - 010 - General") - form_slug = u"archaeological_site-010-general" + form_label = _("General") + form_admin_name = _("Archaeological site - 010 - General") + form_slug = "archaeological_site-010-general" associated_models = {'period': models.Period, 'remain': models.RemainType, 'spatial_reference_system': SpatialReferenceSystem, 'cultural_attribution': models.CulturalAttributionType, @@ -1501,8 +1501,8 @@ class SiteForm(CustomForm, ManageOldType): base_models = ["period", "remain", "collaborator", "cultural_attribution"] pk = forms.IntegerField(required=False, widget=forms.HiddenInput) - reference = forms.CharField(label=_(u"Reference"), max_length=200) - name = forms.CharField(label=_(u"Name"), max_length=200, required=False) + reference = forms.CharField(label=_("Reference"), max_length=200) + name = forms.CharField(label=_("Name"), max_length=200, required=False) other_reference = forms.CharField(label=_("Other reference"), required=False) period = forms.MultipleChoiceField( @@ -1517,29 +1517,29 @@ class SiteForm(CustomForm, ManageOldType): required=False) collaborator = widgets.Select2MultipleField( model=Person, label=_("Collaborators"), required=False, remote=True) - comment = forms.CharField(label=_(u"Comment"), widget=forms.Textarea, + comment = forms.CharField(label=_("Comment"), widget=forms.Textarea, required=False) locality_ngi = forms.CharField( - label=_(u"National Geographic Institute locality"), + label=_("National Geographic Institute locality"), widget=forms.Textarea, required=False ) locality_cadastral = forms.CharField( - label=_(u"Cadastral locality"), + label=_("Cadastral locality"), 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"), + 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=[]) PROFILE_FILTER = { 'mapping': [ @@ -1571,15 +1571,15 @@ class SiteForm(CustomForm, ManageOldType): if 'pk' in self.cleaned_data and self.cleaned_data['pk']: q = q.exclude(pk=self.cleaned_data['pk']) if q.count(): - raise forms.ValidationError(_(u"This reference already exists.")) + raise forms.ValidationError(_("This reference already exists.")) return reference SiteTownFormset = formset_factory(TownForm, can_delete=True, formset=TownFormSet) -SiteTownFormset.form_label = _(u"Towns") -SiteTownFormset.form_admin_name = _(u"Archaeological site - 020 - Towns") -SiteTownFormset.form_slug = u"archaeological_site-020-towns" +SiteTownFormset.form_label = _("Towns") +SiteTownFormset.form_admin_name = _("Archaeological site - 020 - Towns") +SiteTownFormset.form_slug = "archaeological_site-020-towns" def check_underwater_module(self): @@ -1587,24 +1587,24 @@ def check_underwater_module(self): class SiteUnderwaterForm(CustomForm, ManageOldType): - form_label = _(u"Underwater") - form_admin_name = _(u"Archaeological site - 030 - Underwater") - form_slug = u"archaeological_site-030-underwater" + form_label = _("Underwater") + form_admin_name = _("Archaeological site - 030 - Underwater") + form_slug = "archaeological_site-030-underwater" affmar_number = forms.CharField( - label=_(u"AffMar number"), required=False, max_length=100) + label=_("AffMar number"), required=False, max_length=100) drassm_number = forms.CharField( - label=_(u"DRASSM number"), required=False, max_length=100) + label=_("DRASSM number"), required=False, max_length=100) shipwreck_name = forms.CharField( - label=_(u"Shipwreck name"), required=False) + label=_("Shipwreck name"), required=False) shipwreck_code = forms.CharField( - label=_(u"Shipwreck code"), required=False) + label=_("Shipwreck code"), required=False) sinking_date = DateField( - label=_(u"Sinking date"), required=False) + label=_("Sinking date"), required=False) discovery_area = forms.CharField( - label=_(u"Discovery area"), widget=forms.Textarea, required=False) + label=_("Discovery area"), widget=forms.Textarea, required=False) oceanographic_service_localisation = forms.CharField( - label=_(u"Oceanographic service localisation"), + label=_("Oceanographic service localisation"), widget=forms.Textarea, required=False ) @@ -1618,36 +1618,36 @@ class AdministrativeActOpeSelect(TableSelect): _model = models.AdministrativeAct search_vector = forms.CharField( - label=_(u"Full text search"), widget=widgets.SearchWidget( + label=_("Full text search"), widget=widgets.SearchWidget( 'archaeological-operations', 'administrativeact', 'administrativeactop', )) year = forms.IntegerField(label=_("Year")) index = forms.IntegerField(label=_("Index")) if settings.COUNTRY == 'fr': - ref_sra = forms.CharField(label=u"Autre référence", + ref_sra = forms.CharField(label="Autre référence", max_length=15) operation__code_patriarche = forms.CharField( max_length=500, widget=OAWidget, label="Code PATRIARCHE") act_type = forms.ChoiceField(label=_("Act type"), choices=[]) - indexed = forms.NullBooleanField(label=_(u"Indexed?")) + indexed = forms.NullBooleanField(label=_("Indexed?")) operation__towns = get_town_field() - parcel = forms.CharField(label=_(u"Parcel")) + parcel = forms.CharField(label=_("Parcel")) if settings.ISHTAR_DPTS: operation__towns__numero_insee__startswith = forms.ChoiceField( - label=_(u"Department"), choices=[]) - act_object = forms.CharField(label=_(u"Object"), + label=_("Department"), choices=[]) + act_object = forms.CharField(label=_("Object"), max_length=300) history_creator = forms.IntegerField( - label=_(u"Created by"), + label=_("Created by"), widget=widgets.JQueryAutoComplete( reverse_lazy('autocomplete-person', args=['0', 'user']), associated_model=Person), validators=[valid_id(Person)]) history_modifier = forms.IntegerField( - label=_(u"Modified by"), + label=_("Modified by"), widget=widgets.JQueryAutoComplete( reverse_lazy('autocomplete-person', args=['0', 'user']), @@ -1683,7 +1683,7 @@ class AdministrativeActOpeFormSelection(IshtarForm): cleaned_data = self.cleaned_data if 'pk' not in cleaned_data or not cleaned_data['pk']: raise forms.ValidationError( - _(u"You should select an administrative act.")) + _("You should select an administrative act.")) return cleaned_data @@ -1699,12 +1699,12 @@ class AdministrativeActForm(CustomForm, ManageOldType): reverse_lazy('autocomplete-person'), associated_model=Person, new=True), validators=[valid_id(Person)], required=False) - act_object = forms.CharField(label=_(u"Object"), max_length=300, + act_object = forms.CharField(label=_("Object"), max_length=300, widget=forms.Textarea, required=False) signature_date = DateField( - label=_(u"Signature date"), initial=get_now) + label=_("Signature date"), initial=get_now) if settings.COUNTRY == 'fr': - ref_sra = forms.CharField(label=u"Autre référence", max_length=15, + ref_sra = forms.CharField(label="Autre référence", max_length=15, required=False) TYPES = [ @@ -1714,7 +1714,7 @@ class AdministrativeActForm(CustomForm, ManageOldType): class AdministrativeActOpeForm(AdministrativeActForm): - form_admin_name = _(u"Operation - Administrative act - General") + form_admin_name = _("Operation - Administrative act - General") form_slug = "operation-adminact-general" @@ -1748,11 +1748,11 @@ class AdministrativeActModifForm(object): msg = '' if year and max_val: msg = _( - u"This index already exists for year: %(year)d - use a " - u"value bigger than %(last_val)d") % { + "This index already exists for year: %(year)d - use a " + "value bigger than %(last_val)d") % { 'year': year, 'last_val': max_val} else: - msg = _(u"Bad index") + msg = _("Bad index") raise forms.ValidationError(msg) return self.cleaned_data @@ -1765,7 +1765,7 @@ class AdministrativeActOpeModifForm(AdministrativeActModifForm, class FinalAdministrativeActDeleteForm(FinalForm): confirm_msg = " " - confirm_end_msg = _(u"Would you like to delete this administrative act?") + confirm_end_msg = _("Would you like to delete this administrative act?") class DocumentGenerationAdminActForm(IshtarForm): @@ -1788,18 +1788,18 @@ class DocumentGenerationAdminActForm(IshtarForm): def clean(self): if not self.obj: raise forms.ValidationError( - _(u"You should select an administrative act.")) + _("You should select an administrative act.")) cleaned_data = self.cleaned_data try: dt = DocumentTemplate.objects.get( pk=self.cleaned_data['document_template']) except DocumentTemplate.DoesNotExist: - raise forms.ValidationError(_(u"This document is not intended for " - u"this type of act.")) + raise forms.ValidationError(_("This document is not intended for " + "this type of act.")) if self.obj.act_type.pk not in [ act_type.pk for act_type in dt.acttypes.all()]: - raise forms.ValidationError(_(u"This document is not intended for " - u"this type of act.")) + raise forms.ValidationError(_("This document is not intended for " + "this type of act.")) return cleaned_data def save(self, object_pk): @@ -1818,7 +1818,7 @@ class DocumentGenerationAdminActForm(IshtarForm): class GenerateDocForm(IshtarForm): form_label = _("Doc generation") doc_generation = forms.ChoiceField( - required=False, choices=[], label=_(u"Generate the associated doc?")) + required=False, choices=[], label=_("Generate the associated doc?")) def __init__(self, *args, **kwargs): choices = [] @@ -1830,7 +1830,7 @@ class GenerateDocForm(IshtarForm): class AdministrativeActRegisterSelect(AdministrativeActOpeSelect): - indexed = forms.NullBooleanField(label=_(u"Indexed?")) + indexed = forms.NullBooleanField(label=_("Indexed?")) def __init__(self, *args, **kwargs): super(AdministrativeActRegisterSelect, self).__init__(*args, **kwargs) @@ -1839,7 +1839,7 @@ class AdministrativeActRegisterSelect(AdministrativeActOpeSelect): class AdministrativeActRegisterFormSelection(IshtarForm): - form_label = pgettext_lazy('admin act register', u"Register") + form_label = pgettext_lazy('admin act register', "Register") associated_models = {'pk': models.AdministrativeAct} currents = {'pk': models.AdministrativeAct} pk = forms.IntegerField( @@ -1855,7 +1855,7 @@ class AdministrativeActRegisterFormSelection(IshtarForm): cleaned_data = self.cleaned_data if 'pk' not in cleaned_data or not cleaned_data['pk']: raise forms.ValidationError( - _(u"You should select an administrative act.")) + _("You should select an administrative act.")) return cleaned_data @@ -1875,7 +1875,7 @@ class QAOperationFormMulti(QAForm): 'qa_operator', ] qa_operation_type = forms.ChoiceField( - label=_(u"Operation type"), required=False + label=_("Operation type"), required=False ) qa_towns = get_town_field(required=False) qa_operator = forms.IntegerField( |