Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Django application for handling GET query params for url creation
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
query_exchange * fixed no-ascii symbols handling in url prarms
README.md initial code layout
runtests.py fix test execution script
setup.py 0.5 version

README.md

Installation

Add query_exchange to INSTALLED_APPS in your settings.py:

INSTALLLED_APPS = (
    # ...

    'query_exchange',
)

Usage

In python code

query_exchange has reverse_with_query function that reverts url by view name, args and additional query string params

Assumes there is this url config:

 urlpatterns = patterns(
     url('^cinema/(\w+)/$', views.cinema, name='cinema_view')
 )

And it is required to build url to 'cinema_view' with additional date parameter

 from query_exchange import reverse_with_query

 url = reverse_with_query('cinema_view', args=('luxor',), add={'date': '2010-03-12'}, params=request.GET)

the result will be

 /cinema/luxor/?date=2010-03-12

In templates

Before using template tags you have to load correspondent tags library

{% load query_exchange_tags %}
Something went wrong with that request. Please try again.