How can I set success_url based on a parameter?
I really want to go back to where I came from, not some static place. In pseudo code:
url(r'^entry/(?P<pk>\d+)/edit/(?P<category>\d+)',
UpdateView.as_view(model=Entry,
template_name='generic_form_popup.html',
success_url='/category/%(category)')),
Which would mean: edit entry pk and then return to ‘category’. Here an entry can be part of multiple categories.
Create a class
MyUpdateViewinheritted fromUpdateViewand overrideget_success_urlmethod:Also i like to pass such parameters like template_name and model inside of inheritted class view, but not in
.as_view()in urls.py