From 5d92673d4fce9136e113c959b3660def583cac98 Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Fri, 22 Feb 2013 13:31:14 +0100 Subject: [PATCH 1/1] Make prevnext respect get pars --- CHANGES.txt | 2 ++ fnpdjango/templates/fnpdjango/prevnext/next.html | 4 ++-- .../templates/fnpdjango/prevnext/previous.html | 4 ++-- .../templates/fnpdjango/prevnext/prevnext.html | 2 +- fnpdjango/templatetags/fnp_prevnext.py | 14 ++++++++++++-- setup.py | 2 +- 6 files changed, 20 insertions(+), 8 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 71a81a1..f32039e 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,3 +1,5 @@ +v0.1.5 2013-02-22 + - Make prevnext respect current GET parameters. - Add a management command for localizing contrib apps. - Fix deployment sudo problem. diff --git a/fnpdjango/templates/fnpdjango/prevnext/next.html b/fnpdjango/templates/fnpdjango/prevnext/next.html index 928011f..afcc88d 100644 --- a/fnpdjango/templates/fnpdjango/prevnext/next.html +++ b/fnpdjango/templates/fnpdjango/prevnext/next.html @@ -2,7 +2,7 @@ {% load i18n %} -{% endif %} \ No newline at end of file +{% endif %} diff --git a/fnpdjango/templates/fnpdjango/prevnext/previous.html b/fnpdjango/templates/fnpdjango/prevnext/previous.html index 88a656b..3b0f059 100644 --- a/fnpdjango/templates/fnpdjango/prevnext/previous.html +++ b/fnpdjango/templates/fnpdjango/prevnext/previous.html @@ -2,7 +2,7 @@ {% load i18n %} -{% endif %} \ No newline at end of file +{% endif %} diff --git a/fnpdjango/templates/fnpdjango/prevnext/prevnext.html b/fnpdjango/templates/fnpdjango/prevnext/prevnext.html index fd3f9b3..c57d229 100644 --- a/fnpdjango/templates/fnpdjango/prevnext/prevnext.html +++ b/fnpdjango/templates/fnpdjango/prevnext/prevnext.html @@ -2,4 +2,4 @@

{% next_page %} {% previous_page %} -

\ No newline at end of file +

diff --git a/fnpdjango/templatetags/fnp_prevnext.py b/fnpdjango/templatetags/fnp_prevnext.py index 4cfbb08..294cd12 100644 --- a/fnpdjango/templatetags/fnp_prevnext.py +++ b/fnpdjango/templatetags/fnp_prevnext.py @@ -1,3 +1,5 @@ +from copy import copy +from urllib import urlencode from django.template import Library register = Library() @@ -7,7 +9,11 @@ register = Library() def previous_page(context, fallback=None, fallback_title=None): current = context['page_obj'].number if current > 1: - return {'number': current - 1, 'title': None, 'url': None} + get_dict = copy(context['request'].GET) + get_dict['page'] = current - 1 + print get_dict + return {'number': current - 1, 'title': None, 'url': None, + 'get_dict': urlencode(get_dict)} else: return {'number': None, 'title': fallback_title, 'url': fallback} @@ -17,7 +23,11 @@ def next_page(context, fallback=None, fallback_title=None): current = context['page_obj'].number page_range = context['paginator'].page_range if current < page_range[-1]: - return {'number': current + 1, 'title': None, 'url': None} + get_dict = copy(context['request'].GET) + get_dict['page'] = current + 1 + print get_dict + return {'number': current + 1, 'title': None, 'url': None, + 'get_dict': urlencode(get_dict)} else: return {'number': None, 'title': fallback_title, 'url': fallback} diff --git a/setup.py b/setup.py index b00ffd4..174c6c0 100755 --- a/setup.py +++ b/setup.py @@ -22,7 +22,7 @@ def whole_trees(package_dir, paths): setup( name='fnpdjango', - version='0.1.4', + version='0.1.5', author='Radek Czajka', author_email='radoslaw.czajka@nowoczesnapolska.org.pl', url = '', -- 2.20.1