Can someone please explain what is going on here with the Django Tutorial Part 4
Specifically, how the map function is working?
I understand that URLs shouldn’t be hardcoded in the view functions.
return HttpResponseRedirect(reverse('mysite.polls.views.results', args=(p.id,)))
The
reversefunction has access to the URL map that Django uses to find a view function for incoming URLs. In this case, you pass in a view function, and the arguments it will get, and it finds the URL that would map to it. Then the HttpResponseRedirect function creates a response that directs the browser to visit that URL.This is a way of saying, “Now call the mysite.polls.views.results view.”