aboutsummaryrefslogtreecommitdiffstats
path: root/docs/api-guide/pagination.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/api-guide/pagination.md')
-rw-r--r--docs/api-guide/pagination.md6
1 files changed, 5 insertions, 1 deletions
diff --git a/docs/api-guide/pagination.md b/docs/api-guide/pagination.md
index 8ef7c4cc..50be59bf 100644
--- a/docs/api-guide/pagination.md
+++ b/docs/api-guide/pagination.md
@@ -104,7 +104,9 @@ For more complex requirements such as serialization that differs depending on th
To create a custom pagination serializer class you should override `pagination.BasePaginationSerializer` and set the fields that you want the serializer to return.
-For example, to nest a pair of links labelled 'prev' and 'next' you might use something like this.
+You can also override the name used for the object list field, by setting the `results_field` attribute, which defaults to `'results'`.
+
+For example, to nest a pair of links labelled 'prev' and 'next', and set the name for the results field to 'objects', you might use something like this.
class LinksSerializer(serializers.Serializer):
next = pagination.NextURLField(source='*')
@@ -114,4 +116,6 @@ For example, to nest a pair of links labelled 'prev' and 'next' you might use so
links = LinksSerializer(source='*') # Takes the page object as the source
total_results = serializers.Field(source='paginator.count')
+ results_field = 'objects'
+
[cite]: https://docs.djangoproject.com/en/dev/topics/pagination/