Redirection

To redirect to a different page, return a HttpResponseRedirect with the URL [https://docs.djangoproject.com/en/dev/ref/request-response/#django.http.HttpResponseRedirect].

In order to generate the URL to go to from a view name, or a view function identifier, utilize the reverse function [https://docs.djangoproject.com/en/dev/topics/http/urls/#reverse].

If additional arguments along with this redirect have to be passed, they need to be encode into the query string. This can be accomplished with the QueryDict class [https://docs.djangoproject.com/en/dev/ref/request-response/#querydict-objects]: ::

data = QueryDict('', mutable=True)
data['information'] = 'need to be passed'
query_str = data.urlencode()
return HttpResponseRedirect('%s?%s' % (url, query_str))
How_To_Redirect_a_Web_Page.png/
Edit tutorial

Comment on This Data Unit