Peter Hoffmann Director Data Engineering at Blue Yonder. Python Developer, Conference Speaker, Mountaineer

How to generate urls in django

This my Answer to the stackoverflow question: How to generate urls in django:

If you need to use something similar to the {% url %} template tag in your code, Django provides the django.core.urlresolvers.reverse(). The reverse() function has the following signature:

reverse(viewname, urlconf=None, args=None, kwargs=None)