From eaf61449a85b9563d23b2922425c9ed4a67b7bea Mon Sep 17 00:00:00 2001 From: James Beith Date: Mon, 10 Aug 2015 13:02:07 +0100 Subject: [PATCH] Explain use case for `display_value` in docs --- docs/api-guide/relations.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api-guide/relations.md b/docs/api-guide/relations.md index ba3f88063..152f44cdc 100644 --- a/docs/api-guide/relations.md +++ b/docs/api-guide/relations.md @@ -539,7 +539,7 @@ to ``True``. ## The `display_value` method -The `__str__` (`__unicode__` on Python 2) method of the model will be called to generate string representations of the objects used to populate the `choices` property. To provide customized representations, override `display_value` of a `RelatedField` subclass. This method will receive a model object, and should return a string suitable for representing it. For example: +The `__str__` (`__unicode__` on Python 2) method of the model will be called to generate string representations of the objects used to populate the `choices` property. These choices are used to populate select HTML inputs in the browsable API. To provide customized representations for such inputs, override `display_value` of a `RelatedField` subclass. This method will receive a model object, and should return a string suitable for representing it. For example: class TrackPrimaryKeyRelatedField(serializers.PrimaryKeyRelatedField): def display_value(self, instance):