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 | 0f3229a119e53054d98c5e878a9581403628cd08 (patch) | |
tree | e07ad2e91e2544f7b2d61e8f3f653fdda26bfd52 /archaeological_operations/wizards.py | |
parent | cfabd636d0a6d84e8377be3e4d041b4e75ddda9a (diff) | |
download | Ishtar-0f3229a119e53054d98c5e878a9581403628cd08.tar.bz2 Ishtar-0f3229a119e53054d98c5e878a9581403628cd08.zip |
Migrate to python 3 - Clean old migrations and some old scripts
Diffstat (limited to 'archaeological_operations/wizards.py')
-rw-r--r-- | archaeological_operations/wizards.py | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/archaeological_operations/wizards.py b/archaeological_operations/wizards.py index 798e622b4..18a40f040 100644 --- a/archaeological_operations/wizards.py +++ b/archaeological_operations/wizards.py @@ -28,7 +28,7 @@ from django.utils.translation import ugettext_lazy as _ from archaeological_files.models import File from archaeological_operations import models -from forms import GenerateDocForm +from .forms import GenerateDocForm from ishtar_common.forms import reverse_lazy from ishtar_common.models import get_current_profile from ishtar_common.wizards import Wizard, ClosingWizard, DeletionWizard, \ @@ -81,7 +81,7 @@ class OperationWizard(Wizard): archaeological_file = self.get_current_file() if archaeological_file: return ((_("Archaeological file"), - unicode(archaeological_file)),) + str(archaeological_file)),) def get_context_data(self, form, **kwargs): """ @@ -114,7 +114,7 @@ class OperationWizard(Wizard): if not file: return -1 try: - towns = [(town.pk, unicode(town)) for town in file.towns.all()] + towns = [(town.pk, str(town)) for town in file.towns.all()] except (ValueError, ObjectDoesNotExist): pass return sorted(towns, key=lambda x: x[1]) @@ -175,7 +175,7 @@ class OperationWizard(Wizard): multi_value=self.multi_towns) or [] if town_ids: towns = [] - if type(town_ids) == unicode: + if type(town_ids) == str: town_ids = [town_ids] for ids in town_ids: for d in ids.split(','): @@ -189,7 +189,7 @@ class OperationWizard(Wizard): for town_id in town_ids: try: town = models.Town.objects.get(pk=int(town_id)) - towns.append((town.pk, unicode(town))) + towns.append((town.pk, str(town))) except (ValueError, ObjectDoesNotExist): pass data['TOWNS'] = sorted(towns, key=lambda x: x[1]) @@ -317,8 +317,8 @@ class OperationAdministrativeActWizard(OperationWizard): operation_id = self.session_get_value(form_key, "pk") try: return ( - (_(u"Operation"), - unicode(models.Operation.objects.get(pk=operation_id))), + (_("Operation"), + str(models.Operation.objects.get(pk=operation_id))), ) except models.Operation.DoesNotExist: return @@ -328,7 +328,7 @@ class OperationAdministrativeActWizard(OperationWizard): admin = models.AdministrativeAct.objects.get(pk=admin_id) if not admin.operation: return - return ((_(u"Operation"), unicode(admin.operation)),) + return ((_("Operation"), str(admin.operation)),) except models.AdministrativeAct.DoesNotExist: return @@ -387,7 +387,7 @@ class OperationAdministrativeActWizard(OperationWizard): else: break if k == keys[-1]: # the whole list as been traversed - wizard_done_window = unicode(self.wizard_done_window) + wizard_done_window = str(self.wizard_done_window) if wizard_done_window: dct['wizard_done_window'] = wizard_done_window # redirect to the generated doc @@ -399,8 +399,8 @@ class OperationAdministrativeActWizard(OperationWizard): if hasattr(self.request.user, 'ishtaruser') else None if ishtaruser and ishtaruser.current_profile \ and ishtaruser.current_profile.auto_pin: - self.request.session[self.current_obj_slug] = unicode(admact.pk) - self.request.session[self.get_object_name(admact)] = unicode( + self.request.session[self.current_obj_slug] = str(admact.pk) + self.request.session[self.get_object_name(admact)] = str( admact.pk) res = render(self.request, 'ishtar/wizard/wizard_done.html', dct) |