1
0
mirror of https://github.com/django/django.git synced 2025-11-07 07:15:35 +00:00

Fixed #17159 -- Validated returned number of next|previous_page_number

Thanks mehta.apurva at gmail.com for the report and the initial patch
and neaf for the complete patch.
This commit is contained in:
Claude Paroz
2012-06-09 17:55:24 +02:00
parent ef906b1632
commit fc40a6504b
4 changed files with 35 additions and 19 deletions

View File

@@ -154,6 +154,16 @@ Unicode parameters (``password``, ``salt`` or ``encoded``). If any of the
hashing methods need byte strings, you can use the
:func:`~django.utils.encoding.smart_str` utility to encode the strings.
Validation of previous_page_number and next_page_number
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
When using :doc:`object pagination </topics/pagination>`,
the ``previous_page_number()`` and ``next_page_number()`` methods of the
:class:`~django.core.paginator.Page` object did not check if the returned
number was inside the existing page range.
It does check it now and raises an :exc:`InvalidPage` exception when the number
is either too low or too high.
Features deprecated in 1.5
==========================