Django templatetags to simplify creating, updating, and removing query parameters from querystring
Project description
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 %} {% set_query_parameters page=2 order=desc %} # => page=2&limit=20&order=desc
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 %} {% del_query_parameters page order %} # => limit=20
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.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | d626fa1db6b35000f10060b08ed04f149e5228ebb9d39f58f3aded38156f4611 |
|
MD5 | 53ca5335c6321d9e0899a1c3caf74de6 |
|
BLAKE2b-256 | 62d621dee9173d0defec802d181e588903c0a3d776db4cd95781d4146f2dded8 |