id summary reporter owner description type status component version severity resolution keywords cc stage has_patch needs_docs needs_tests needs_better_patch easy ui_ux 4730 Django Tutorial Part 4 - Suggestion adroffne@… Jacob "The last paragraph in Django Tutorial Part 4 misses a point about generic views. I had problems getting the /polls/ app to work using generic views. The generic views must be made unique in the URLconf (urls.py) file. The mysite.polls.views.vote ""view"" ends with a HttpResponseRedirect, which has to send users to a generic view (for poll results). Since both the ""details"" and ""results"" pages have the same python function reference name (generic view), urls.py couldn't tell them apart. I found two solutions to this issue. 1) Reorder urlpatterns in urls.py so that the ""results"" line is before the ""details"" one. Then, they will be unique on regular expression, and ""results"" will match first. [BETTER] 2) Add the 4th ""view-name"" parameter to urlpatterns tuples to make the ""details"" and ""results"" views unique. I chose to enter this: urlpatterns = patterns('', (r'^$', 'django.views.generic.list_detail.object_list', info_dict), (r'^(?P\d+)/$', 'django.views.generic.list_detail.object_detail', info_dict, 'poll-ballot'), (r'^(?P\d+)/results/$', 'django.views.generic.list_detail.object_detail', dict(info_dict, template_name='polls/results.html'), 'poll-results'), (r'^(?P\d+)/vote/$', 'mysite.polls.views.vote'), ) Please, change the tutorial near LAST PARAGRAPH to explain all this. This is not an obvious point! LAST PARAGRAPH (Of Django Tutorial Part 4): The vote() view is still required. However, it must be modified to match the new templates and context variables. Change the template call from polls/detail.html to polls/poll_detail.html, and pass object in the context instead of poll. " closed Documentation dev duplicate Unreviewed 0 0 0 0 0 0