diff options
Diffstat (limited to 'rest_framework/fields.py')
| -rw-r--r-- | rest_framework/fields.py | 12 | 
1 files changed, 8 insertions, 4 deletions
| diff --git a/rest_framework/fields.py b/rest_framework/fields.py index 21a1effd..f3e17b18 100644 --- a/rest_framework/fields.py +++ b/rest_framework/fields.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals  from django.conf import settings  from django.core.exceptions import ObjectDoesNotExist  from django.core.exceptions import ValidationError as DjangoValidationError @@ -10,7 +11,8 @@ from django.utils.translation import ugettext_lazy as _  from rest_framework import ISO_8601  from rest_framework.compat import (      EmailValidator, MinValueValidator, MaxValueValidator, -    MinLengthValidator, MaxLengthValidator, URLValidator, OrderedDict +    MinLengthValidator, MaxLengthValidator, URLValidator, OrderedDict, +    unicode_repr, unicode_to_repr  )  from rest_framework.exceptions import ValidationError  from rest_framework.settings import api_settings @@ -113,7 +115,9 @@ class CreateOnlyDefault:          return self.default      def __repr__(self): -        return '%s(%s)' % (self.__class__.__name__, repr(self.default)) +        return unicode_to_repr( +            '%s(%s)' % (self.__class__.__name__, unicode_repr(self.default)) +        )  class CurrentUserDefault: @@ -124,7 +128,7 @@ class CurrentUserDefault:          return self.user      def __repr__(self): -        return '%s()' % self.__class__.__name__ +        return unicode_to_repr('%s()' % self.__class__.__name__)  class SkipField(Exception): @@ -463,7 +467,7 @@ class Field(object):          This allows us to create descriptive representations for serializer          instances that show all the declared fields on the serializer.          """ -        return representation.field_repr(self) +        return unicode_to_repr(representation.field_repr(self))  # Boolean types... | 
