joashivanmoodley / django-pagination

Automatically exported from code.google.com/p/django-pagination
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Paginator returns a full object list if the page number is invalid #1

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
If you type an invalid page number (e.g. ?page=3450) the paginator returns
the full list of objects. I would suggest to return an empty list and a key
like "invalid_page" to mark it.

So my template looks like this now:

    {% autopaginate object_list 10 %}
    {% if invalid_page %}
        This page does not exists (anymore).
    {% endif %}    
    ... display object list ...
    {% paginate %}

Also the paginator fails if somebody uses strings as a page number. In this
case the default page number should be "1".

Original issue reported on code.google.com by mar...@mahner.org on 4 Jul 2008 at 10:19

Attachments:

GoogleCodeExporter commented 8 years ago
Example: http://pinax.hotcluboffrance.com/tribes/?page=asdfasdf

Original comment by leidel on 4 Jul 2008 at 10:23

GoogleCodeExporter commented 8 years ago
Fixed in r21.  Thanks, Martin Mahner and Jannis Leidel!

Original comment by flo...@gmail.com on 13 Jul 2008 at 10:18