diff --git a/rest_framework/utils/representation.py b/rest_framework/utils/representation.py index e64fdd223..180b51f8d 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'