class documentation

class Paginator:

View In Hierarchy

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.
Constant ELLIPSIS Undocumented
Instance Variable allow​_empty​_first​_page Undocumented
Instance Variable object​_list Undocumented
Instance Variable orphans Undocumented
Instance Variable per​_page Undocumented
Method __init__ Undocumented
Method __iter__ Undocumented
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.
Method validate​_number Validate the given 1-based page number.
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.
def get_elided_page_range(self, number=1, *, on_each_side=3, on_ends=2):

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):
Return a valid page, even if the page argument isn't a number or isn't in range.
def page(self, number):
Return a Page object for the given 1-based page number.
ELLIPSIS =

Undocumented

Value
_('')
allow_empty_first_page =

Undocumented

object_list =

Undocumented

orphans =

Undocumented

per_page =

Undocumented

def __init__(self, object_list, per_page, orphans=0, allow_empty_first_page=True):

Undocumented

def __iter__(self):

Undocumented

def _check_object_list_is_ordered(self):
Warn if self.object_list is unordered (typically a QuerySet).
def _get_page(self, *args, **kwargs):

Return an instance of a single page.

This hook can be used by subclasses to use an alternative to the standard :cls:`Page` object.

def validate_number(self, number):
Validate the given 1-based page number.
@cached_property
count =
Return the total number of objects, across all pages.
@cached_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.