Improved pagination documentation

* Link to the topic guide
* Document that page() can raise PageNotAnInteger.
This commit is contained in:
Adam Johnson 2021-02-08 23:38:55 +00:00 committed by Carlton Gibson
parent a2fa2fa2f8
commit a57e91adee
1 changed files with 5 additions and 1 deletions

View File

@ -6,6 +6,8 @@ Django provides a few classes that help you manage paginated data -- that is,
data that's split across several pages, with "Previous/Next" links. These data that's split across several pages, with "Previous/Next" links. These
classes live in :source:`django/core/paginator.py`. classes live in :source:`django/core/paginator.py`.
For examples, see the :doc:`Pagination topic guide </topics/pagination>`.
.. module:: django.core.paginator .. module:: django.core.paginator
:synopsis: Classes to help you easily manage paginated data. :synopsis: Classes to help you easily manage paginated data.
@ -72,7 +74,9 @@ Methods
.. method:: Paginator.page(number) .. method:: Paginator.page(number)
Returns a :class:`Page` object with the given 1-based index. Raises Returns a :class:`Page` object with the given 1-based index. Raises
:exc:`InvalidPage` if the given page number doesn't exist. :exc:`PageNotAnInteger` if the ``number`` cannot be converted to an integer
by calling ``int()``. Raises :exc:`InvalidPage` if the given page number
doesn't exist.
.. method:: Paginator.get_elided_page_range(number, *, on_each_side=3, on_ends=2) .. method:: Paginator.get_elided_page_range(number, *, on_each_side=3, on_ends=2)