aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/generics.py
diff options
context:
space:
mode:
authorTom Christie2015-01-16 16:55:46 +0000
committerTom Christie2015-01-16 16:55:46 +0000
commit8b0f25aa0a91cb7b56f9ce4dde4330fe5daaad9b (patch)
tree9c0805b1d5206eb160455bbf485d3dd05a915124 /rest_framework/generics.py
parent50db8c092ab51a5eb94e2bb495c317097fceeb59 (diff)
downloaddjango-rest-framework-8b0f25aa0a91cb7b56f9ce4dde4330fe5daaad9b.tar.bz2
More pagination tests & cleanup
Diffstat (limited to 'rest_framework/generics.py')
-rw-r--r--rest_framework/generics.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/rest_framework/generics.py b/rest_framework/generics.py
index 4cc4c64d..61dcb84a 100644
--- a/rest_framework/generics.py
+++ b/rest_framework/generics.py
@@ -151,6 +151,9 @@ class GenericAPIView(views.APIView):
@property
def paginator(self):
+ """
+ The paginator instance associated with the view, or `None`.
+ """
if not hasattr(self, '_paginator'):
if self.pagination_class is None:
self._paginator = None
@@ -159,11 +162,18 @@ class GenericAPIView(views.APIView):
return self._paginator
def paginate_queryset(self, queryset):
+ """
+ Return a single page of results, or `None` if pagination is disabled.
+ """
if self.paginator is None:
- return queryset
+ return None
return self.paginator.paginate_queryset(queryset, self.request, view=self)
def get_paginated_response(self, data):
+ """
+ Return a paginated style `Response` object for the given output data.
+ """
+ assert self.paginator is not None
return self.paginator.get_paginated_response(data)