﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
10941	Add a templatetag to generate querystrings	Ben Spaulding	Tom Carrick	"Working with pagination and query strings within a template can be painful. Personally, I have never had a situation when I was paginating using a GET parameter where there were not other parameters that needed to be preserved through out the various pages.

Take search, for example. There may be parameters for searching within one or more models, for a particular author and sorting by date. Maintaining all of these parameters within the pagination links takes some serious template logic.

{{{
{# Linebreaks added for readability. In real life this would need to be one, long line. #}
<a href=""?{% for key, values in request.GET.iterlists %}
  {% ifnotequal key ""page"" %}
    {% for value in values %}
      {{ key }}={{ value }}&amp;
    {% endfor %}
  {% endifnotequal %}
{% endfor %}page={{ page.next_page_number }}"">Next page</a>
}}}

That kind of logic shouldn’t be in a template. I have created a patch that would allow for something much simpler, like so:

{{{
<a href=""?{{ page.next_page_querystring }}"">Next page</a>
}}}

Though there has been much talk of creating template tags which would produce all-out pagination bars, I believe this particular functionality should be an actual method on the page object for two reasons:

 1. This is basic functionality whose end result is hard to dispute (as opposed to a full pagination bar where markup and features could be disputed eternally),
 2. This does not require the request context processor to be installed.

Note that this patch includes documentation. Tests are still needed. I am not married to the exact implementation, but I and others I have discussed this and feel that this simplicity and fuctionality belong in Django’s pagination.
"	New feature	closed	Template system	dev	Normal	fixed	pagination	dan.fairs@… Ning Thomas Capricelli Carsten Fuchs	Ready for checkin	1	0	0	0	0	0
