Skip to content

sophilabs/django-qurl-templatetag

Repository files navigation

Django QUrl Template Tag

Documentation Status Updates

A Django template tag to modify url's query string.

Documentation

The full documentation is at https://django-url-templatetag.readthedocs.org.

Quick Start

Install Django QUrl Template Tag:

pip install django-qurl-templatetag

After installation is done, add qurl_templatetag to the INSTALLED_APPS setting in your settings.py file:

INSTALLED_APPS = (
    # …
    'qurl_templatetag',
    # …
)

Usage

{% load qurl %}

{% qurl url [param]* [as <var_name>] %}

Parameters:
        name=value: replace all values of name by one value
        name=None: remove all values of name
        name+=value: append a new value for name
        name-=value: remove the value of name with the value

Example:

    {% qurl '/search?page=1&color=blue&color=green' order='name' page=None color+='red' color-='green' %}
    Output: /search?color=blue&order=name&color=red

    {% qurl request.get_full_path order='name' %}

Tests

$ pip install -r requirements/test.pip
$ python runtests.py

About

https://res.cloudinary.com/jsconfuy/image/upload/c_pad,f_auto,h_200,w_200,e_trim/v1426608244/xuwbunompvfjaxuazlwo.png

Django Qurl Template Tag is maintained and funded by sophilabs, inc. The names and logos for sophilabs are trademarks of sophilabs, inc.