Django templatetags to simplify creating, updating, and removing query parameters from querystring
Project description
django-query-parameters
Adds two template tags that simplify the manipulation of GET parameters on a querystring. Allows easy addition, manipulation, and deletion of parameters onto an existing querystring.
The module is comprised of two template tags: set_query_parameters and del_query_parameters.
set_query_parameters
Takes a 1+ list of key=value pairs and generates an updated querystring that includes those pairs. If a key does not already exist in the querystring, it will be added. If a key exists, it will be updated with the new value. For example:
# current page is http://localhost/?page=1&limit=20 {% load query_parameters %} <a href="?{% set_query_parameters page=2 order=desc %}">...</a> # => <a href="?page=2&limit=20&order=desc">...</a>
del_query_parameters
Takes a 1+ list of keys and generates an updated querystring that removes those keys. If a key does not exist in the query string, it will be ignored. For example:
# current page is http://localhost/?page=1&limit=20 {% load query_parameters %} <a href="?{% del_query_parameters page order %}">...</a> # => <a href="?limit=20">...</a>
Installing
Installing is a simple as running an easy_install or pip install command:
pip install django-query-parameters
Include the project in the INSTALLED_APPS list in your project’s settings.py file:
INSTALLED_APPS = (..., 'query_parameters', ...)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Hashes for django-query-parameters-0.1.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | c54ec1ac3db6f207c178f80b990e9bbfe2737b0cce0d897189945db8dfbc84fd |
|
MD5 | 82ce7a86e34aa3d4c9c173f3ada619c6 |
|
BLAKE2b-256 | bc35c34e2ffb3496fdc7e150b2c202a0c3ed636a6fe4da2e0b95c1d0121f7674 |