1
+ from __future__ import unicode_literals
1
2
from django .conf import settings
2
3
from django .core .exceptions import ObjectDoesNotExist
3
4
from django .core .exceptions import ValidationError as DjangoValidationError
10
11
from rest_framework import ISO_8601
11
12
from rest_framework .compat import (
12
13
EmailValidator , MinValueValidator , MaxValueValidator ,
13
- MinLengthValidator , MaxLengthValidator , URLValidator , OrderedDict
14
+ MinLengthValidator , MaxLengthValidator , URLValidator , OrderedDict ,
15
+ unicode_repr , unicode_to_repr
14
16
)
15
17
from rest_framework .exceptions import ValidationError
16
18
from rest_framework .settings import api_settings
@@ -113,7 +115,9 @@ def __call__(self):
113
115
return self .default
114
116
115
117
def __repr__ (self ):
116
- return '%s(%s)' % (self .__class__ .__name__ , repr (self .default ))
118
+ return unicode_to_repr (
119
+ '%s(%s)' % (self .__class__ .__name__ , unicode_repr (self .default ))
120
+ )
117
121
118
122
119
123
class CurrentUserDefault :
@@ -124,7 +128,7 @@ def __call__(self):
124
128
return self .user
125
129
126
130
def __repr__ (self ):
127
- return '%s()' % self .__class__ .__name__
131
+ return unicode_to_repr ( '%s()' % self .__class__ .__name__ )
128
132
129
133
130
134
class SkipField (Exception ):
@@ -463,7 +467,7 @@ def __repr__(self):
463
467
This allows us to create descriptive representations for serializer
464
468
instances that show all the declared fields on the serializer.
465
469
"""
466
- return representation .field_repr (self )
470
+ return unicode_to_repr ( representation .field_repr (self ) )
467
471
468
472
469
473
# Boolean types...
0 commit comments