November 2015
Beginner to intermediate
840 pages
26h 30m
English
In Chapter 5: Creating Webpages with Controllers in Django, we saw how to use the HttpResponseRedirect class and redirect shortcut to redirect a URL pattern to another URL path and pattern (respectively) via a function view. At the time, we did not understand how Django was reversing the URL pattern into a URL. The redirect shortcut should now be much clearer. For the sake of clarity, let’s walk through the process again.
We started with the code shown in Example 6.46 in /suorganizer/views.py.
Example 6.46: Project Code
suorganizer/views.py in 2e8036623d
1 from django.http import HttpResponseRedirect 2 3 4 def redirect_root(request): 5 return HttpResponseRedirect('/blog/' ...
Read now
Unlock full access