use 'reverse' from javascript
Python JavaScript Shell
Pull request Compare This branch is 19 commits behind barbuza:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
jsroutes
testproject
.gitignore
MANIFEST.in
README.md
buildenv.sh
setup.py
test.sh

README.md

jsroutes

use django's reverse function from javascript

Requirements

nothing

Usage

there are two ways of using jsroutes

1st

  • add "jsroutes" to INSTALLED_APPS
  • add url("^someprefix/", include("jsroutes.urls")) to your urlconf
  • include <script type="text/javascript" src="{% url jsroutes %}"></script> in your templates

2nd

  • add "jsroutes" to INSTALLED_APPS
  • call manage.py generate_jsroutes somefilename.js
  • include <script type="text/javascript" src="{{ STATIC_URL }}somefilename.js"></script> in your templates

after it you can call django_url_reverse(name, args) from javascript