Code

Opened 4 years ago

Closed 4 years ago

#13258 closed (wontfix)

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

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

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'),
)

Attachments (0)

Change History (1)

comment:1 Changed 4 years ago by russellm

  • milestone 1.2 deleted
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to wontfix
  • Status changed from new to closed

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.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.