module documentation
Pagination serializers determine the structure of the output that should be used for paginated responses.
Class |
|
Undocumented |
Class |
|
The cursor pagination implementation is necessarily complex. For an overview of the position/offset style we use, see this post: https://cra.mr/2011/03/08/building-cursors-for-the-disqus-api |
Class |
|
A limit/offset based style. For example: |
Class |
|
A simple page number based style that supports page numbers as query parameters. For example: |
Constant | PAGE |
Undocumented |
Variable |
|
Undocumented |
Variable |
|
Undocumented |
Function | _divide |
Returns 'a' divided by 'b', with any remainder rounded up. |
Function | _get |
This utility function determines a list of page numbers to display. This gives us a nice contextually relevant set of page numbers. |
Function | _get |
Given a list of page numbers and `None` page breaks, return a list of `PageLink` objects. |
Function | _positive |
Cast a string to a strictly positive integer. |
Function | _reverse |
Given an order_by tuple such as `('-created', 'uuid')` reverse the ordering and return a new tuple, eg. `('created', '-uuid')`. |
This utility function determines a list of page numbers to display. This gives us a nice contextually relevant set of page numbers. For example: current=14, final=16 -> [1, None, 13, 14, 15, 16] This implementation gives one page to each side of the cursor, or two pages to the side when the cursor is at the edge, then ensures that any breaks between non-continuous page numbers never remove only a single page. For an alternative implementation which gives two pages to each side of the cursor, eg. as in GitHub issue list pagination, see: https://gist.github.com/tomchristie/321140cebb1c4a558b15