1 2 3 4 5 6 | from django.utils.functional import lazy
from django.core.urlresolvers import reverse
# Workaround for using reverse with success_url in class based generic views
# because direct usage of it throws an exception.
reverse_lazy = lambda name=None, *args : lazy(reverse, str)(name, args=args)
|
More like this
- RestView - class for creating a view that dispatches based on request.method by simon 4 years, 8 months ago
- HTTPS redirections middleware with updated URL template tag by xlq 7 months ago
- DebugMiddleware footer with links to quick open file/line# in TextMate on local machine by felix_the_third 3 years, 4 months ago
- Using reverse() to do redirects by ubernostrum 5 years, 9 months ago
- RFC: Shim to allow view classes rather than functions by peterbraden 4 years, 2 months ago
Comments
Until Django 1.4 is released and reverse_lazy is included in Django, this snippet does the trick.
#