Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support get the numbers of objects are normally display in per page. #46

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions doc/templatetags_reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,12 @@ of page links. You can use *pages* in different ways:

{{ pages|length }}

- display numbers of objects in per page:

.. code-block:: html+django

{{ pages.per_page_number }}

- check if the page list contains more than one page:

.. code-block:: html+django
Expand Down
4 changes: 4 additions & 0 deletions endless_pagination/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,3 +238,7 @@ def next(self):
def paginated(self):
"""Return True if this page list contains more than one page."""
return len(self) > 1

def per_page_number(self):
"""Return the numbers of objects are normally display in per page."""
return self._page.paginator.per_page