Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sophilabs/django-qurl-templatetag
A Django template tag to modify url's query string.
https://github.com/sophilabs/django-qurl-templatetag
django python querystring templatetag url
Last synced: about 1 month ago
JSON representation
A Django template tag to modify url's query string.
- Host: GitHub
- URL: https://github.com/sophilabs/django-qurl-templatetag
- Owner: sophilabs
- License: mit
- Created: 2013-11-06T03:05:03.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2020-04-22T19:53:38.000Z (over 4 years ago)
- Last Synced: 2024-04-26T11:20:25.916Z (7 months ago)
- Topics: django, python, querystring, templatetag, url
- Language: Python
- Homepage:
- Size: 82 KB
- Stars: 56
- Watchers: 2
- Forks: 12
- Open Issues: 1
-
Metadata Files:
- Readme: README.rst
- Contributing: CONTRIBUTING.rst
- License: LICENSE
Awesome Lists containing this project
- stars - sophilabs/django-qurl-templatetag - A Django template tag to modify url's query string. (Python)
- stars - sophilabs/django-qurl-templatetag - A Django template tag to modify url's query string. (Python)
README
===============================
Django QUrl Template Tag
===============================.. image:: https://img.shields.io/pypi/v/django-qurl-templatetag.svg
:target: https://pypi.python.org/pypi/django-qurl-templatetag.. image:: https://img.shields.io/travis/sophilabs/django-qurl-templatetag.svg
:target: https://travis-ci.org/sophilabs/django-qurl-templatetag.. image:: https://readthedocs.org/projects/django-qurl-templatetag/badge/?version=latest
:target: http://django-qurl-templatetag.readthedocs.io/en/latest/?badge=latest
:alt: Documentation Status.. image:: https://pyup.io/repos/github/sophilabs/django-qurl-templatetag/shield.svg
:target: https://pyup.io/repos/github/sophilabs/django-qurl-templatetag/
:alt: Updates.. image:: https://img.shields.io/codecov/c/github/sophilabs/django-qurl-templatetag.svg
:target: https://codecov.io/gh/sophilabs/django-qurl-templatetagA 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:
.. code-block::
pip install django-qurl-templatetag
After installation is done, add ``qurl_templatetag`` to the ``INSTALLED_APPS`` setting in your settings.py file:
.. code-block::
INSTALLED_APPS = (
# …
'qurl_templatetag',
# …
)Tag Usage
---------.. code-block::
{% load qurl %}
{% qurl url [param]* [as ] %}
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
name++: increment the value by one
name--: decrement the value by oneExample:
{% 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' %}
Library Usage
-------------A Qurl object has a set of chainable methods to modify the querystring parameters.
Available methods are:
* set: replace all values of name by one value, parameter is removed when value is None
* add: append a new value for name
* remove: remove the value of name with the value
* inc: increment the value by another value (optional, defaults to 1)
* dec: decrement the value by another value (optional, defaults to 1)
* get: build the url.. code-block::
from qurl_templatetag import Qurl
>>> Qurl('http://www.sophilabs.co/?page=1&tags=python')\
.inc('page', value=2)\
.add('tags', 'django')\
.add('tags', 'web')\
.remove('tags', 'python')\
.get()
http://www.sophilabs.co/?page=3&tags=django&tags=webTests
-----.. code-block::
$ pip install -r requirements/test.pip
$ python runtests.pyAbout
-----.. image:: https://s3.amazonaws.com/sophilabs-assets/logo/logo_300x66.gif
:target: https://sophilabs.coDjango Qurl Template Tag is maintained and funded by sophilabs, inc. The names and logos for
sophilabs are trademarks of sophilabs, inc.