diff options
| author | Tom Christie | 2014-08-29 11:38:54 +0100 |
|---|---|---|
| committer | Tom Christie | 2014-08-29 11:38:54 +0100 |
| commit | b8c8d10a18741b76355ed7035655d0101c1d778a (patch) | |
| tree | fea6b954cd38ff837a2eff3b255a51c60e79f48c | |
| parent | e5e6329a222def3b0745f90fc55ee36de95ada83 (diff) | |
| download | django-rest-framework-b8c8d10a18741b76355ed7035655d0101c1d778a.tar.bz2 | |
Remove `page_size` argument.
`paginate_queryset` no longer takes an optional `page_size` argument.
| -rw-r--r-- | rest_framework/generics.py | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/rest_framework/generics.py b/rest_framework/generics.py index e21dc5c7..09035303 100644 --- a/rest_framework/generics.py +++ b/rest_framework/generics.py @@ -111,26 +111,14 @@ class GenericAPIView(views.APIView): context = self.get_serializer_context() return pagination_serializer_class(instance=page, context=context) - def paginate_queryset(self, queryset, page_size=None): + def paginate_queryset(self, queryset): """ Paginate a queryset if required, either returning a page object, or `None` if pagination is not configured for this view. """ - deprecated_style = False - if page_size is not None: - warnings.warn('The `page_size` parameter to `paginate_queryset()` ' - 'is deprecated. ' - 'Note that the return style of this method is also ' - 'changed, and will simply return a page object ' - 'when called without a `page_size` argument.', - DeprecationWarning, stacklevel=2) - deprecated_style = True - else: - # Determine the required page size. - # If pagination is not configured, simply return None. - page_size = self.get_paginate_by() - if not page_size: - return None + page_size = self.get_paginate_by() + if not page_size: + return None paginator = self.paginator_class(queryset, page_size) page_kwarg = self.kwargs.get(self.page_kwarg) @@ -152,8 +140,6 @@ class GenericAPIView(views.APIView): 'message': str(exc) }) - if deprecated_style: - return (paginator, page, page.object_list, page.has_other_pages()) return page def filter_queryset(self, queryset): |
