Document correct method usage for get_paginated_response in 3.x instead

of old get_pagination_serializer only valid in 2.x
This commit is contained in:
Ernesto Chavez Sanchez 2015-04-30 02:23:39 +00:00
parent 2eb9107b87
commit 0ffb0abe81
2 changed files with 2 additions and 2 deletions

View File

@ -193,7 +193,7 @@ You won't typically need to override the following methods, although you might n
* `get_serializer_context(self)` - Returns a dictionary containing any extra context that should be supplied to the serializer. Defaults to including `'request'`, `'view'` and `'format'` keys. * `get_serializer_context(self)` - Returns a dictionary containing any extra context that should be supplied to the serializer. Defaults to including `'request'`, `'view'` and `'format'` keys.
* `get_serializer(self, instance=None, data=None, files=None, many=False, partial=False, allow_add_remove=False)` - Returns a serializer instance. * `get_serializer(self, instance=None, data=None, files=None, many=False, partial=False, allow_add_remove=False)` - Returns a serializer instance.
* `get_pagination_serializer(self, page)` - Returns a serializer instance to use with paginated data. * `get_paginated_response(self, page)` - Returns a serializer instance to use with paginated data.
* `paginate_queryset(self, queryset)` - Paginate a queryset if required, either returning a page object, or `None` if pagination is not configured for this view. * `paginate_queryset(self, queryset)` - Paginate a queryset if required, either returning a page object, or `None` if pagination is not configured for this view.
* `filter_queryset(self, queryset)` - Given a queryset, filter it with whichever filter backends are in use, returning a new queryset. * `filter_queryset(self, queryset)` - Given a queryset, filter it with whichever filter backends are in use, returning a new queryset.

View File

@ -137,7 +137,7 @@ For example:
def recent_users(self, request): def recent_users(self, request):
recent_users = User.objects.all().order('-last_login') recent_users = User.objects.all().order('-last_login')
page = self.paginate_queryset(recent_users) page = self.paginate_queryset(recent_users)
serializer = self.get_pagination_serializer(page) serializer = self.get_paginated_response(page)
return Response(serializer.data) return Response(serializer.data)
The decorators can additionally take extra arguments that will be set for the routed view only. For example... The decorators can additionally take extra arguments that will be set for the routed view only. For example...