Skip to main content
https://img.shields.io/pypi/v/django-qurl-templatetag.svg https://img.shields.io/travis/sophilabs/django-qurl-templatetag.svg Documentation Status Updates https://img.shields.io/codecov/c/github/sophilabs/django-qurl-templatetag.svg

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',
    # …
)

Tag 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
        name++: increment the value by one
        name--: decrement the value by one

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' %}

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

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=web

Tests

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

About

https://s3.amazonaws.com/sophilabs-assets/logo/logo_300x66.gif

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

Metadata

Release files for django-qurl-templatetag 0.0.14

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-qurl-templatetag 0.0.14
File Size Uploaded Provenance
django-qurl-templatetag-0.0.14.tar.gz 13.9 kB Without provenance Details

Release files / django-qurl-templatetag-0.0.14.tar.gz

Download URL django-qurl-templatetag-0.0.14.tar.gz
Size 13.9 kB
Tags Source
SHA-256 checksum
How to use checksums
bba09228bde037659ae678f8c69438156e0ee71c297ae219979804187eef9025
BLAKE2b-256 checksum
How to use checksums
b7ce12d548e042c6cbb89839061cc382bd668e28f552aed9f94bc7f263dc6499
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.6.7

Security for django-qurl-templatetag 0.0.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.0.14 This release

1 release file No provenance

0.0.3

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page