diff --git a/django/oldforms/__init__.py b/django/oldforms/__init__.py index d0f9aca62a..a0f14cdcf2 100644 --- a/django/oldforms/__init__.py +++ b/django/oldforms/__init__.py @@ -3,7 +3,7 @@ from django.core.exceptions import PermissionDenied from django.utils.html import escape from django.conf import settings from django.utils.translation import ugettext, ungettext -from django.utils.encoding import smart_unicode, force_unicode, smart_str +from django.utils.encoding import smart_unicode, force_unicode FORM_FIELD_ID_PREFIX = 'id_' @@ -502,7 +502,7 @@ class SelectField(FormField): def isValidChoice(self, data, form): str_data = smart_unicode(data) - str_choices = [smart_str(item[0]) for item in self.choices] + str_choices = [smart_unicode(item[0]) for item in self.choices] if str_data not in str_choices: raise validators.ValidationError, ugettext("Select a valid choice; '%(data)s' is not in %(choices)s.") % {'data': str_data, 'choices': str_choices} diff --git a/tests/modeltests/manipulators/models.py b/tests/modeltests/manipulators/models.py index 7f1ff0e47b..46063828b9 100644 --- a/tests/modeltests/manipulators/models.py +++ b/tests/modeltests/manipulators/models.py @@ -54,7 +54,7 @@ True # Attempt to create an Album with an invalid musician. >>> man.get_validation_errors(MultiValueDict({'name': ['Sallies Fforth'], 'musician': ['foo']})) -{'musician': [u"Select a valid choice; 'foo' is not in ['', '1']."]} +{'musician': [u"Select a valid choice; 'foo' is not in [u'', u'1']."]} # Attempt to create an Album with an invalid release_date. >>> man.get_validation_errors(MultiValueDict({'name': ['Sallies Fforth'], 'musician': ['1'], 'release_date': 'today'}))