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
- Treat empty value on DateRangeFilter as a filter for non filled dates by kmmbvnr 1 month ago
- Django Settings Assignment Expressions aka Walrus Operator example by webology 2 months ago
- codigo alto nivel by MrRocklion 4 months ago
- Load template from specific app by Krzysiek555 4 months, 3 weeks ago
- PostgreSQL JSON subqueries by dolamroth 4 months, 3 weeks ago