diff options
Diffstat (limited to 'ishtar_common/forms_common.py')
| -rw-r--r-- | ishtar_common/forms_common.py | 28 | 
1 files changed, 14 insertions, 14 deletions
| diff --git a/ishtar_common/forms_common.py b/ishtar_common/forms_common.py index a92b53e29..0f8b4d416 100644 --- a/ishtar_common/forms_common.py +++ b/ishtar_common/forms_common.py @@ -37,11 +37,11 @@ from django.forms.models import BaseModelFormSet, BaseFormSet  from django.utils.safestring import mark_safe  from django.utils.translation import ugettext_lazy as _, pgettext -import models -import widgets +from . import models +from . import widgets  from bootstrap_datepicker.widgets import DatePicker  from ishtar_common.templatetags.link_to_window import simple_link_to_window -from forms import FinalForm, FormSet, reverse_lazy, name_validator, \ +from .forms import FinalForm, FormSet, reverse_lazy, name_validator, \      TableSelect, ManageOldType, CustomForm, FieldType, FormHeader, \      FormSetWithDeleteSwitches, BSForm, get_data_from_formset, \      file_size_validator, HistorySelect, CustomFormSearch, QAForm @@ -87,7 +87,7 @@ def get_person_field(label=_(u"Person"), required=True, person_types=[]):      url = "/" + settings.URL_PATH + 'autocomplete-person'      if person_types:          person_types = [ -            unicode(models.PersonType.objects.get(txt_idx=person_type).pk) +            str(models.PersonType.objects.get(txt_idx=person_type).pk)              for person_type in person_types]          url += u"/" + u'_'.join(person_types)      widget = widgets.JQueryAutoComplete(url, associated_model=models.Person) @@ -111,7 +111,7 @@ class NewItemForm(forms.Form):              if key in self.fields and hasattr(self.fields[key], 'choices'):                  new_choices = []                  for value, lbl in self.fields[key].choices: -                    if unicode(value) in self.limits[key]: +                    if str(value) in self.limits[key]:                          new_choices.append((value, lbl))                  self.fields[key].choices = new_choices                  if len(new_choices) == 1: @@ -144,7 +144,7 @@ class NewImportForm(BSForm, forms.ModelForm):              self.fields.pop('associated_group')          else:              self.fields['associated_group'].choices = [(None, '--')] + \ -                [(g.pk, unicode(g)) for g in groups.all()] +                [(g.pk, str(g)) for g in groups.all()]          self.fields['importer_type'].choices = [('', '--')] + [              (imp.pk, imp.name) for imp in models.ImporterType.objects.filter(                  available=True @@ -223,7 +223,7 @@ class TargetKeyForm(forms.ModelForm):              self.fields['target'].choices = [(instance.target.pk,                                                instance.target.verbose_name)]              self.fields['key'].widget.attrs['readonly'] = True -            self.fields['key'].widget.attrs['title'] = unicode(instance) +            self.fields['key'].widget.attrs['title'] = str(instance)              self.fields['value'].choices = list(                  instance.target.get_choices())              self.fields['value'].choices.insert( @@ -241,7 +241,7 @@ class TargetKeyForm(forms.ModelForm):                  and (self.associated_import.associated_group.all_user_can_modify                       or self.user.is_superuser):              choices += [ -                ('group', unicode(_(u"the current group: {}")).format( +                ('group', str(_(u"the current group: {}")).format(                      self.associated_import.associated_group))]          if self.user.is_superuser:              choices += [('all', _("all users"))] @@ -424,7 +424,7 @@ class MergeIntoForm(forms.Form):                  continue              self.fields['main_item'].choices.append(                  (item.pk, mark_safe(u"{} {}".format(simple_link_to_window(item), -                                                    unicode(item))))) +                                                    str(item)))))      def merge(self):          model = self.associated_model @@ -433,7 +433,7 @@ class MergeIntoForm(forms.Form):          except model.DoesNotExist:              return          for pk in self.items: -            if pk == unicode(main_item.pk): +            if pk == str(main_item.pk):                  continue              try:                  item = model.objects.get(pk=pk) @@ -875,7 +875,7 @@ class ProfilePersonForm(forms.Form):              if profile.current:                  current_profile = profile                  initial['current_profile'] = profile.pk -            choices.append((profile.pk, unicode(profile))) +            choices.append((profile.pk, str(profile)))          if current_profile:              initial['name'] = current_profile.name or \                                current_profile.profile_type @@ -946,7 +946,7 @@ class ProfilePersonForm(forms.Form):          if self.cleaned_data.get('duplicate_profile', None):              profile_name = profile.name or profile.profile_type.label              if name == profile_name: -                name += unicode(_(u" (duplicate)")) +                name += str(_(u" (duplicate)"))              profile.duplicate(name=name)              return @@ -1103,11 +1103,11 @@ class MergeOrganizationForm(MergeForm):  def get_image_help():      if not settings.IMAGE_MAX_SIZE:          return max_size_help() -    return unicode( +    return str(          _(u"Heavy images are resized to: %(width)dx%(height)d "               u"(ratio is preserved).") \             % {'width': settings.IMAGE_MAX_SIZE[0], -              'height': settings.IMAGE_MAX_SIZE[1]}) + " " + unicode( +              'height': settings.IMAGE_MAX_SIZE[1]}) + " " + str(          max_size_help()) | 
