diff --git a/aldryn_forms/admin/views.py b/aldryn_forms/admin/views.py index 673bca65..5206aa87 100644 --- a/aldryn_forms/admin/views.py +++ b/aldryn_forms/admin/views.py @@ -95,13 +95,7 @@ def done(self, form_list, **kwargs): content_type = self.get_content_type() - response_kwargs = {} - - if int(get_version().split('.')[1]) > 6: - response_kwargs['content_type'] = content_type - else: - # Django <= 1.6 compatibility - response_kwargs['mimetype'] = content_type + response_kwargs = {'content_type': content_type} response = HttpResponse(dataset.xls, **response_kwargs) response['Content-Disposition'] = 'attachment; filename=%s' % filename diff --git a/aldryn_forms/cms_plugins.py b/aldryn_forms/cms_plugins.py index 01813da6..0552a8fa 100644 --- a/aldryn_forms/cms_plugins.py +++ b/aldryn_forms/cms_plugins.py @@ -285,7 +285,7 @@ class Field(FormElement): def serialize_value(self, instance, value, is_confirmation=False): if isinstance(value, query.QuerySet): - value = u', '.join(map(text_type, value)) + value = ', '.join(map(text_type, value)) elif value is None: value = '-' return text_type(value) diff --git a/aldryn_forms/contrib/email_notifications/cms_plugins.py b/aldryn_forms/contrib/email_notifications/cms_plugins.py index 519308ca..a55db4b2 100644 --- a/aldryn_forms/contrib/email_notifications/cms_plugins.py +++ b/aldryn_forms/contrib/email_notifications/cms_plugins.py @@ -4,6 +4,7 @@ from django.contrib import admin from django.core.mail import get_connection +from django.utils.html import mark_safe from django.utils.translation import ugettext_lazy as _ from cms.plugin_pool import plugin_pool @@ -104,14 +105,14 @@ def text_variables(self, obj): for category, choices in choices_by_category: #
{0}
'.format(self.text_variables_help_text) - return unordered_list + u'\n' + help_text + unordered_list = '{0}
'.format(self.text_variables_help_text) + return mark_safe(unordered_list + '\n' + help_text) text_variables.allow_tags = True text_variables.short_description = _('available text variables') diff --git a/aldryn_forms/contrib/email_notifications/models.py b/aldryn_forms/contrib/email_notifications/models.py index 39718f36..2fa4d1ca 100644 --- a/aldryn_forms/contrib/email_notifications/models.py +++ b/aldryn_forms/contrib/email_notifications/models.py @@ -118,7 +118,7 @@ class Meta: def __str__(self): to_name = self.get_recipient_name() to_email = self.get_recipient_email() - return u'{0} ({1})'.format(to_name, to_email) + return '{0} ({1})'.format(to_name, to_email) def clean(self): recipient_email = self.get_recipient_email() diff --git a/aldryn_forms/forms.py b/aldryn_forms/forms.py index 08e0413b..b2da6451 100644 --- a/aldryn_forms/forms.py +++ b/aldryn_forms/forms.py @@ -219,7 +219,7 @@ def clean(self): min_value = self.cleaned_data.get('min_value') max_value = self.cleaned_data.get('max_value') if min_value and max_value and min_value > max_value: - self.append_to_errors('min_value', _(u'Min value can not be greater than max value.')) + self.append_to_errors('min_value', _('Min value can not be greater than max value.')) return self.cleaned_data @@ -228,11 +228,11 @@ class TextFieldForm(MinMaxValueForm): def __init__(self, *args, **kwargs): super(TextFieldForm, self).__init__(*args, **kwargs) - self.fields['min_value'].label = _(u'Min length') - self.fields['min_value'].help_text = _(u'Required number of characters to type.') + self.fields['min_value'].label = _('Min length') + self.fields['min_value'].help_text = _('Required number of characters to type.') - self.fields['max_value'].label = _(u'Max length') - self.fields['max_value'].help_text = _(u'Maximum number of characters to type.') + self.fields['max_value'].label = _('Max length') + self.fields['max_value'].help_text = _('Maximum number of characters to type.') self.fields['max_value'].required = False class Meta: @@ -309,11 +309,11 @@ class MultipleSelectFieldForm(MinMaxValueForm): def __init__(self, *args, **kwargs): super(MultipleSelectFieldForm, self).__init__(*args, **kwargs) - self.fields['min_value'].label = _(u'Min choices') - self.fields['min_value'].help_text = _(u'Required amount of elements to chose.') + self.fields['min_value'].label = _('Min choices') + self.fields['min_value'].help_text = _('Required amount of elements to chose.') - self.fields['max_value'].label = _(u'Max choices') - self.fields['max_value'].help_text = _(u'Maximum amount of elements to chose.') + self.fields['max_value'].label = _('Max choices') + self.fields['max_value'].help_text = _('Maximum amount of elements to chose.') class Meta: # 'required' and 'required_message' depend on min_value field validator diff --git a/aldryn_forms/models.py b/aldryn_forms/models.py index 96dd1faf..15d1ab3d 100644 --- a/aldryn_forms/models.py +++ b/aldryn_forms/models.py @@ -78,10 +78,10 @@ def field_id(self): field_label = self.label.strip() if field_label: - field_as_string = u'{}-{}'.format(field_label, self.field_type) + field_as_string = '{}-{}'.format(field_label, self.field_type) else: field_as_string = self.name - field_id = u'{}:{}'.format(field_as_string, self.field_occurrence) + field_id = '{}:{}'.format(field_as_string, self.field_occurrence) return field_id @property @@ -261,10 +261,10 @@ def get_form_fields(self): if field_plugin.name: field_name = field_plugin.name else: - field_name = u'{0}_{1}'.format(field_type, field_type_occurrence) + field_name = '{0}_{1}'.format(field_type, field_type_occurrence) if field_label: - field_id = u'{0}_{1}'.format(field_type, field_label) + field_id = '{0}_{1}'.format(field_type, field_label) else: field_id = field_name @@ -591,7 +591,7 @@ def _form_data_hook(self, data, occurrences): if field_label: field_type = data['name'].rpartition('_')[0] - field_id = u'{}_{}'.format(field_type, field_label) + field_id = '{}_{}'.format(field_type, field_label) else: field_id = data['name'] diff --git a/aldryn_forms/sizefield/models.py b/aldryn_forms/sizefield/models.py index d30d6cb1..c33496d4 100644 --- a/aldryn_forms/sizefield/models.py +++ b/aldryn_forms/sizefield/models.py @@ -8,7 +8,7 @@ class FileSizeField(models.BigIntegerField): default_error_messages = { - 'invalid': _(u'Incorrect file size format.'), + 'invalid': _('Incorrect file size format.'), } def formfield(self, **kwargs): diff --git a/setup.py b/setup.py index aa10a311..cc3317d4 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ 'djangocms-text-ckeditor', 'djangocms-attributes-field>=1.0.0', 'django-tablib', - 'tablib', + 'tablib==0.13.0', 'pillow', 'django-filer', 'django-sizefield',