Commit 03818ed0 by Tom Christie

Pagination tweaks and docs

parent 44d42221
...@@ -259,7 +259,7 @@ class PageNumberPagination(BasePagination): ...@@ -259,7 +259,7 @@ class PageNumberPagination(BasePagination):
) )
raise NotFound(msg) raise NotFound(msg)
if paginator.count > 1: if paginator.count > 1 and self.template is not None:
# The browsable API should display pagination controls. # The browsable API should display pagination controls.
self.display_page_controls = True self.display_page_controls = True
...@@ -347,7 +347,7 @@ class LimitOffsetPagination(BasePagination): ...@@ -347,7 +347,7 @@ class LimitOffsetPagination(BasePagination):
self.offset = self.get_offset(request) self.offset = self.get_offset(request)
self.count = _get_count(queryset) self.count = _get_count(queryset)
self.request = request self.request = request
if self.count > self.limit: if self.count > self.limit and self.template is not None:
self.display_page_controls = True self.display_page_controls = True
return queryset[self.offset:self.offset + self.limit] return queryset[self.offset:self.offset + self.limit]
...@@ -518,7 +518,7 @@ class CursorPagination(BasePagination): ...@@ -518,7 +518,7 @@ class CursorPagination(BasePagination):
# Display page controls in the browsable API if there is more # Display page controls in the browsable API if there is more
# than one page. # than one page.
if self.has_previous or self.has_next: if (self.has_previous or self.has_next) and self.template is not None:
self.display_page_controls = True self.display_page_controls = True
return self.page return self.page
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment