From: Radek Czajka Date: Fri, 22 Feb 2013 12:31:14 +0000 (+0100) Subject: Make prevnext respect get pars X-Git-Tag: 0.1.5 X-Git-Url: https://git.mdrn.pl/fnpdjango.git/commitdiff_plain/5d92673d4fce9136e113c959b3660def583cac98?ds=inline;hp=37f4488273c93928f2d6e89fda3c0aefcd42db43 Make prevnext respect get pars --- 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 = '',