From 742c7194284dfbe5f051e8c6652d72f00e47f88f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20St=C4=99pniowski?= Date: Wed, 1 Oct 2008 12:56:38 +0200 Subject: [PATCH 1/1] Patched pagination_tags.py in pagination app to raise Http404 if page doesn't exist. --- apps/pagination/templatetags/pagination_tags.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/apps/pagination/templatetags/pagination_tags.py b/apps/pagination/templatetags/pagination_tags.py index 55e5392fe..4908421ea 100644 --- a/apps/pagination/templatetags/pagination_tags.py +++ b/apps/pagination/templatetags/pagination_tags.py @@ -84,9 +84,11 @@ class AutoPaginateNode(template.Node): try: page_obj = paginator.page(context['request'].page) except InvalidPage: - context[key] = [] - context['invalid_page'] = True - return u'' + # context[key] = [] + # context['invalid_page'] = True + # return u'' + from django.http import Http404 + raise Http404 context[key] = page_obj.object_list context['paginator'] = paginator context['page_obj'] = page_obj -- 2.20.1