class documentation

class Paginator: (source)

View In Hierarchy

Undocumented

Method __init__ Undocumented
Method __iter__ Undocumented
Method get_elided_page_range Return a 1-based range of pages with some values elided.
Method get_page Return a valid page, even if the page argument isn't a number or isn't in range.
Method page Return a Page object for the given 1-based page number.
Method validate_number Validate the given 1-based page number.
Constant ELLIPSIS Undocumented
Instance Variable allow_empty_first_page Undocumented
Instance Variable object_list Undocumented
Instance Variable orphans Undocumented
Instance Variable per_page Undocumented
Property count Return the total number of objects, across all pages.
Property num_pages Return the total number of pages.
Property page_range Return a 1-based range of pages for iterating through within a template for loop.
Method _check_object_list_is_ordered Warn if self.object_list is unordered (typically a QuerySet).
Method _get_page Return an instance of a single page.
def __init__(self, object_list, per_page, orphans=0, allow_empty_first_page=True): (source)

Undocumented

def __iter__(self): (source)

Undocumented

def get_elided_page_range(self, number=1, *, on_each_side=3, on_ends=2): (source)

Return a 1-based range of pages with some values elided. If the page range is larger than a given size, the whole range is not provided and a compact form is returned instead, e.g. for a paginator with 50 pages, if page 43 were the current page, the output, with the default arguments, would be: 1, 2, …, 40, 41, 42, 43, 44, 45, 46, …, 49, 50.

def get_page(self, number): (source)

Return a valid page, even if the page argument isn't a number or isn't in range.

def page(self, number): (source)

Return a Page object for the given 1-based page number.

def validate_number(self, number): (source)

Validate the given 1-based page number.

ELLIPSIS = (source)

Undocumented

Value
_('')
allow_empty_first_page = (source)

Undocumented

object_list = (source)

Undocumented

Undocumented

per_page = (source)

Undocumented

Return the total number of objects, across all pages.

Return the total number of pages.

Return a 1-based range of pages for iterating through within a template for loop.

def _check_object_list_is_ordered(self): (source)

Warn if self.object_list is unordered (typically a QuerySet).

def _get_page(self, *args, **kwargs): (source)

Return an instance of a single page. This hook can be used by subclasses to use an alternative to the standard :cls:`Page` object.