- May 21, 2011
- reverse class-based-generic-view success_url
- 3 (after 3 ratings)
If you did tried to use
reverse function to set
success_url in class based generic views and you have got an exception, this helper function may help.
Put this snipped in some file, for example utils.py and import this function.
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
- ModelForm-based create_update generic views by carljm 6 years, 10 months ago
- View Redirect Decorators by bryanpieper 4 years, 10 months ago
- RelatedMixin for Details and Updates with Related Object Lists by christhekeele 3 years ago
- RestView - class for creating a view that dispatches based on request.method by simon 6 years, 8 months ago
- Class based generic views that automatically check permissions by humphreymurray 4 years, 4 months ago