diff --git a/rest_framework/relations.py b/rest_framework/relations.py index 330d17c08..8f433d421 100644 --- a/rest_framework/relations.py +++ b/rest_framework/relations.py @@ -148,7 +148,7 @@ class RelatedField(Field): return OrderedDict([ ( six.text_type(self.to_representation(item)), - six.text_type(item) + six.text_type(self.display_value(item)) ) for item in queryset ]) @@ -160,6 +160,9 @@ class RelatedField(Field): def iter_options(self): return iter_options(self.grouped_choices) + def display_value(self, instance): + return six.text_type(instance) + class StringRelatedField(RelatedField): """