aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/utils/representation.py
diff options
context:
space:
mode:
authorTom Christie2014-10-01 13:24:47 +0100
committerTom Christie2014-10-01 13:24:47 +0100
commitc630a12e26f29145784523dd1b01ab0b3576f42c (patch)
tree394975775960ec6fa6db1df1f09adc56b544a9af /rest_framework/utils/representation.py
parent381771731f48c75e7d5951e353049cceec386512 (diff)
downloaddjango-rest-framework-c630a12e26f29145784523dd1b01ab0b3576f42c.tar.bz2
Deal with lazy strings in serializer reprs
Diffstat (limited to 'rest_framework/utils/representation.py')
-rw-r--r--rest_framework/utils/representation.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/rest_framework/utils/representation.py b/rest_framework/utils/representation.py
index e64fdd22..180b51f8 100644
--- a/rest_framework/utils/representation.py
+++ b/rest_framework/utils/representation.py
@@ -3,6 +3,8 @@ Helper functions for creating user-friendly representations
of serializer classes and serializer fields.
"""
from django.db import models
+from django.utils.functional import Promise
+from rest_framework.compat import force_text
import re
@@ -19,6 +21,9 @@ def smart_repr(value):
if isinstance(value, models.Manager):
return manager_repr(value)
+ if isinstance(value, Promise) and value._delegate_text:
+ value = force_text(value)
+
value = repr(value)
# Representations like u'help text'