Here’s how to, from a view, redirect to another URL passing parameters to it. For instance, to redirect the user to a certain page after login:
return HttpResponseRedirect(reverse('dz_details', kwargs={'dz_id':dz.id}))
This will lookup the ‘dz_details’ name in your urls.py file, which could be defined like so:
url(r'^details/(\d+)/$', views.dz_details, name='dz_details'),
There is a simpler way to do it, if you don’t want to use the parameters’ names, but you have to know the order on which they appear in the method:
return HttpResponseRedirect(reverse('dz_details', args=[ dz.id ]))
Related:
- [Django] Dynamic redirection after login Here’s how to redirect to the login page in django,...
- Java HTTP proxy servlet (with Spring) I always wanted to build my own proxy. I’m kidding....







[...] This post was Twitted by nocivus [...]