django-urltags 0.1 documentation
Usage: {% add_qs_param url varname value %}
This tag intelligently adds or replaces the query string parameter varname and assigns it value.
url, varname, and value can be static values or variables
Adding a single query string parameter
{% add_qs_param http://example.com/ q 1 %}
generates:
http://example.com/?q=1
Adding a query string parameter to a URL with a query string.
{% add_qs_param http://example.com/?sort=asc q 1 %}
generates:
http://example.com/?sort=asc&q=1
Adding a query string parameter to a URL that already has that parameter.
{% add_qs_param http://example.com/?q=5 q 1 %}
generates:
http://example.com/?q=1
Adding a query string parameter to a URL that has a page fragment.
{% add_qs_param http://example.com/#gohere q 1 %}
generates:
http://example.com/?q=1#gohere
Usage: {{ url|add_fragment:variable }} or {{ url|add_fragment:"fragment" }}
This tag intelligently adds or replaces the URL fragment. You can pass a variable as the parameter to add_fragment or a static value. You must quote static values.