Skip to content
a helper for url querystrings
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Django Url Helper

Helper function and template tags for dealing with numeric url query strings in Django.


  1. pip install django_url_helper
  2. Add django_url_helper to your INSTALLED_APPS
  3. You're all set!

Basic Usage

In templates: put {% load url_helper %} on top of your template. given a variable in template url which resolves into The following steps are applied and demostrated in order.

  1. Applying {% add_param url 'page' '1' %} would resolve into
  2. Then, {% toggle_param url 'page' '1' %} would toggle off the page=1, resolving into
  3. Then, {% toggle_param url 'page' '1' %} would toggle on the page=1 , which would resolve into
  4. Then, {% reset_param url 'k' '2' %} would reset k to value 2, resolves to
  5. Then, {% remove_param url 'k' '2' %} would remove any k=2 query string in target url. In our case this would resolve into
  6. Finally, {% purge_param url 'page' %} would remove any query string with key page, this will give us


Tests are ran using pytest, any contibutions are welcomed.

You can’t perform that action at this time.