Export to GitHub

django-pagination - issue #1

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


Posted on Jul 4, 2008 by Happy Elephant

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".

Attachments

Comment #1

Posted on Jul 4, 2008 by Swift Panda

Example: http://pinax.hotcluboffrance.com/tribes/?page=asdfasdf

Comment #2

Posted on Jul 13, 2008 by Happy Kangaroo

Fixed in r21. Thanks, Martin Mahner and Jannis Leidel!

Status: Fixed

Labels:
Type-Defect Priority-Medium