aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/serializers.py
diff options
context:
space:
mode:
authorTom Christie2014-12-15 11:55:17 +0000
committerTom Christie2014-12-15 11:55:17 +0000
commit72e08a3e8b6427cb93f0f98b42724e31e5b3d8f9 (patch)
tree9d2fe5ded957a5e1c6d86ac87aeafb4be3055ab2 /rest_framework/serializers.py
parenta72f812d80a4000e86a5ad96001f3fbf43fe310a (diff)
downloaddjango-rest-framework-72e08a3e8b6427cb93f0f98b42724e31e5b3d8f9.tar.bz2
Use unicode internally everywhere for 'repr'
Diffstat (limited to 'rest_framework/serializers.py')
-rw-r--r--rest_framework/serializers.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/rest_framework/serializers.py b/rest_framework/serializers.py
index 5adbca3b..e9860a2f 100644
--- a/rest_framework/serializers.py
+++ b/rest_framework/serializers.py
@@ -10,12 +10,11 @@ python primitives.
2. The process of marshalling between python primitives and request and
response content is handled by parsers and renderers.
"""
-import warnings
-
+from __future__ import unicode_literals
from django.db import models
from django.db.models.fields import FieldDoesNotExist
from django.utils.translation import ugettext_lazy as _
-
+from rest_framework.compat import unicode_to_repr
from rest_framework.utils import model_meta
from rest_framework.utils.field_mapping import (
get_url_kwargs, get_field_kwargs,
@@ -29,6 +28,7 @@ from rest_framework.validators import (
UniqueForDateValidator, UniqueForMonthValidator, UniqueForYearValidator,
UniqueTogetherValidator
)
+import warnings
# Note: We do the following so that users of the framework can use this style:
@@ -396,7 +396,7 @@ class Serializer(BaseSerializer):
return attrs
def __repr__(self):
- return representation.serializer_repr(self, indent=1)
+ return unicode_to_repr(representation.serializer_repr(self, indent=1))
# The following are used for accessing `BoundField` instances on the
# serializer, for the purposes of presenting a form-like API onto the
@@ -564,7 +564,7 @@ class ListSerializer(BaseSerializer):
return self.instance
def __repr__(self):
- return representation.list_repr(self, indent=1)
+ return unicode_to_repr(representation.list_repr(self, indent=1))
# Include a backlink to the serializer class on return objects.
# Allows renderers such as HTMLFormRenderer to get the full field info.