Class Based View Passing Parameters
I have just started using Class-based views and I am trying to pass the parameters to class-based view as: return HttpResponseRedirect(reverse('myView'), kwargs={'method': 'learnin
Solution 1:
You have the parentheses in the wrong place. kwargs
is a parameter to reverse
, not to HttpResponseRedirect
.
return HttpResponseRedirect(reverse('myView', kwargs={'method': 'learning'}))
Note, this could be shortened by using the redirect
shortcut:
return redirect('myView', method='learning')
Solution 2:
kwargs
should be reverse function's argument:
return HttpResponseRedirect(reverse('myView', kwargs={'method': 'learning'}))
Post a Comment for "Class Based View Passing Parameters"