diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2019-02-27 20:44:52 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2019-06-17 13:21:27 +0200 |
commit | 86c03a98d11e93880b4568776e0939113a92a707 (patch) | |
tree | e07ad2e91e2544f7b2d61e8f3f653fdda26bfd52 /archaeological_operations/forms.py | |
parent | 52f442699a72ff5d0341a7d15d5b966a3cc2bd60 (diff) | |
download | Ishtar-86c03a98d11e93880b4568776e0939113a92a707.tar.bz2 Ishtar-86c03a98d11e93880b4568776e0939113a92a707.zip |
Migrate to python 3 - Clean old migrations and some old scripts
Diffstat (limited to 'archaeological_operations/forms.py')
-rw-r--r-- | archaeological_operations/forms.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/archaeological_operations/forms.py b/archaeological_operations/forms.py index 26ded30fa..e3cdfeb4e 100644 --- a/archaeological_operations/forms.py +++ b/archaeological_operations/forms.py @@ -33,7 +33,7 @@ from django.forms.formsets import formset_factory, DELETION_FIELD_NAME, \ from django.utils.safestring import mark_safe from django.utils.translation import ugettext_lazy as _, pgettext_lazy -import models +from . import models from archaeological_files.models import File from archaeological_operations.utils import parse_parcels from bootstrap_datepicker.widgets import DateField @@ -47,7 +47,7 @@ from ishtar_common.models import valid_id, Person, Town, \ person_type_pks_lazy, person_type_pk_lazy, organization_type_pks_lazy, \ organization_type_pk_lazy, SpatialReferenceSystem, Area from ishtar_common.wizards import MultiValueDict -from widgets import ParcelWidget, SelectParcelWidget, OAWidget +from .widgets import ParcelWidget, SelectParcelWidget, OAWidget class ParcelField(forms.MultiValueField): @@ -134,7 +134,7 @@ class ParcelForm(IshtarForm): town = towns[town] else: try: - towns[town] = unicode(Town.objects.get(pk=town)) + towns[town] = str(Town.objects.get(pk=town)) town = towns[town] except (Town.DoesNotExist, ValueError): town = '' @@ -154,7 +154,7 @@ class ParcelForm(IshtarForm): else: c_number = 0 values = [town, data.get('year') or '', data.get('section') or '', - c_number, unicode(_(u"public domain")) + c_number, str(_(u"public domain")) if data.get('public_domain') else u""] if data.get('DELETE'): deleted.append(values) @@ -173,7 +173,7 @@ class ParcelForm(IshtarForm): grouped = [] for keys, parcel_grp in groupby(parcels, key=sortkeyfn): keys = list(keys) - keys.append([u' '.join([unicode(gp[-2]), unicode(gp[-1])]) + keys.append([u' '.join([str(gp[-2]), str(gp[-1])]) for gp in parcel_grp]) grouped.append(keys) res = '' @@ -192,7 +192,7 @@ class ParcelForm(IshtarForm): res += section + u' ' res += u", ".join(parcel_numbers) if year: - res += " (%s)" % unicode(year) + res += " (%s)" % str(year) return res @@ -429,7 +429,7 @@ class RecordRelationsForm(ManageOldType): pk=data.get('right_record')) except cls.current_related_model.DoesNotExist: continue - values = [unicode(relation_type), right_record.reference] + values = [str(relation_type), right_record.reference] if data.get('DELETE'): deleted.append(values) else: @@ -459,7 +459,7 @@ class RecordRelationsFormSetBase(FormSet): def _construct_forms(self): # instantiate all the forms and put them in self.forms self.forms = [] - for i in xrange(self.total_form_count()): + for i in range(self.total_form_count()): self.forms.append(self._construct_form( i, left_record=self.left_record)) @@ -986,7 +986,7 @@ class OperationFormModifGeneral(OperationFormGeneral): self.fields.pop('associated_file') fields = OrderedDict() - for idx, field in enumerate(self.fields.items()): + for idx, field in enumerate(list(self.fields.items())): key, value = field if 'associated_file' in self.fields and ( key == 'in_charge' or idx > 6): @@ -1718,7 +1718,7 @@ class GenerateDocForm(IshtarForm): choices = kwargs.pop('choices') super(GenerateDocForm, self).__init__(*args, **kwargs) self.fields['doc_generation'].choices = [('', u'-' * 9)] + \ - [(choice.pk, unicode(choice)) for choice in choices] + [(choice.pk, str(choice)) for choice in choices] class AdministrativeActRegisterSelect(AdministrativeActOpeSelect): |