Pagination¶
get_page¶
-
djem.pagination.get_page(number, object_list, per_page=None, **kwargs)[source]¶ New in version 0.5.
A simple wrapper around a Django
Paginatorthat immediately invokes itspage()method and returns aPageobject.numberis the number of the page to retrieve, as a 1-based index. If the given value is not an integer, or it is less than1, it is treated as1. If it is greater than the total number of pages, it is treated asPaginator.num_pages.object_listis the sequence of items from which to retrieve the specified page - as a list, tuple,QuerySetor any other sliceable object with acount()or__len__()method.per_pageis the number of results to be included in each page. Not required ifDJEM_DEFAULT_PAGE_LENGTHhas been defined.All other keyword arguments of the
Paginatorconstructor are also accepted and passed through to thePaginatorinstance created internally.
See also
DJEM_DEFAULT_PAGE_LENGTH- The setting for controlling the default value of the
per_pageargument. paginate- A templatetag for rendering a block of pagination links based on a given
Pageobject.