Tutorial: rerender or redirect questions
I have a question about the definition of function vote in part 4 of
the tutorial.
If the user presses the button Vote without selecting a choice, this
function renders the template polls/detail.html to redisplay the poll
detail with an error message. However, the URL in the address bar of
the browser still shows /polls/n/vote/. In the RESTful spirit of
things, assuming URLs are important, I think the address bar should
now show /polls/n/, as we are simply displaying the poll detail page
not processing a vote. This would seem to require a redirect to /
polls/n/ instead of a rerendering of polls/detail.html.
So my questions are:
1. Is the above analysis reasonable. Do readers agree that the new
URL should be /polls/n/ instead of /polls/n/vote/?
2. If we do want this revised behaviour, how can we redirect to the
URL /polls/n/ *and* pass an error message at the same time?
Slightly off the topic, when exactly can one replace the constructor
HttpResponseRedirect by the new shortcut redirect?
Thanks for your attention.
Rodney
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home