From dcbff8649c4835a64975d28161a1cebb278180ea Mon Sep 17 00:00:00 2001 From: jtauber Date: Wed, 18 Jun 2008 09:48:32 +0000 Subject: [PATCH] paging maintains other GET parameters -- contributed by jezdez git-svn-id: https://django-pagination.googlecode.com/svn/trunk@14 7f1efe38-554e-0410-b69d-834cb44da2d5 --- .../templates/pagination/pagination.html | 25 ++++++++++++++++--- pagination/templatetags/pagination_tags.py | 7 +++++- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/pagination/templates/pagination/pagination.html b/pagination/templates/pagination/pagination.html index 8abee2d..3799314 100644 --- a/pagination/templates/pagination/pagination.html +++ b/pagination/templates/pagination/pagination.html @@ -1,8 +1,25 @@ {% if is_paginated %} -{% endif %} \ No newline at end of file +{% endif %} diff --git a/pagination/templatetags/pagination_tags.py b/pagination/templatetags/pagination_tags.py index e688b05..6db06ba 100644 --- a/pagination/templatetags/pagination_tags.py +++ b/pagination/templatetags/pagination_tags.py @@ -114,11 +114,16 @@ def paginate(context, window=4): pages.extend(second_list) else: pages.extend(sorted(list(last.difference(current)))) - return { + + getvars = context['request'].GET.copy() + if 'page' in getvars: + del getvars['page'] + return { 'pages': pages, 'page_obj': page_obj, 'paginator': paginator, 'is_paginated': paginator.count > paginator.per_page, + 'getvars': "&%s" % getvars.urlencode() } except KeyError: return u'' -- 2.20.1