Opened 14 years ago

Closed 14 years ago

#13258 closed (wontfix)

Writing your first Django app, part 4, urls.py

Reported by: julyzergcn1@… Owned by: nobody
Component: Documentation Version: dev
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

maybe the urls.py should be like this at last.

from django.conf.urls.defaults import *
from mysite.polls.models import Poll

info_dict = {
    'queryset': Poll.objects.all(),
}

urlpatterns = patterns('',
    url(r'^$', 'django.views.generic.list_detail.object_list', dict(info_dict, template_object_name='latest_poll', template_name='polls/index.html')),
    
    url(r'^(?P<object_id>\d+)/$', 'django.views.generic.list_detail.object_detail', dict(info_dict, template_object_name='poll', template_name='polls/detail.html')),
    
    url(r'^(?P<object_id>\d+)/results/$', 'django.views.generic.list_detail.object_detail', dict(info_dict, template_object_name='poll', template_name='polls/results.html'), 'poll_results'),
    
    (r'^(?P<poll_id>\d+)/vote/$', 'mysite.polls.views.vote'),
)

Change History (1)

comment:1 by Russell Keith-Magee, 14 years ago

milestone: 1.2
Resolution: wontfix
Status: newclosed

The existing example is correct, it is significantly simpler, and it highlights some important consistency issues introduced by the use of generic views.

Given that this ticket doesn't contain any description of *why* these changes are required, I'm closing wontfix.

Note: See TracTickets for help on using tickets.
Back to Top