On Mon, Aug 13, 2012 at 10:46 PM, Syam Palakurthy <syampalakur...@gmail.com>wrote:
> Hi - I could not find any explanation that fixed the problem, until I ran > across this person's abridged Django tutorial: > http://tony.abou-assaleh.net/web-development/stripped-down-django-tutorial > > It's basically a line in the details template, which should be: > > <form action="/polls/{{ poll.id }}/vote/" method="post"> > > > Instead of: > > <form action="{% url 'polls.views.vote' poll.id %}" method="post"> > > > I'm not sure why this fixed the issue, but it did for me. I'd love an > explanation if anyone has one. > > This is not a typo in the tutorial. The {% url %} variant is a faily recent update to the current development level of the online docs. It was added in order to show in the tutorial best practices: url reversal by name rather than hard-coding url paths in the template. However, it uses the {% url %} tag syntax that is correct for the upcoming Django release, 1.5. In order for that syntax (specifically, the quotes around polls.views.vote) to work in the 1.4 released version, the template would also have to include {% import url from future %}. This "from future" import is not necessary in the current development level of code, so was not included when this change to demonstrate how to use {% url %} was added to the tutorial development level. However it seems that many many many people are running through the development-level doc with the 1.4- released level code, so perhaps we should add a note here (or more prominently elsewhere) to please be sure you run through the online version of the tutorial that matches the level of code you are running. Karen -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.