Opened 16 years ago

Closed 16 years ago

Last modified 13 years ago

#10579 closed (invalid)

Generic views tutorial

Reported by: zvikara Owned by: nobody
Component: Documentation Version: 1.0
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

In Writing your first Django app, part 4,
When changing the sample to use generic views,

  1. polls/urls.py must include template_object_name:
    info_dict = {
        'queryset': Poll.objects.all(),
        'template_object_name': 'poll',
    }
    
    
  1. In poll_list.html, you must change latest_poll_list to poll_list.

(This is in django 1.02)

Change History (2)

comment:1 by James Bennett, 16 years ago

Resolution: invalid
Status: newclosed

The section on setting up generic views already states:

In previous parts of the tutorial, the templates have been provided with a context that contains the poll and latest_poll_list context variables. However, the generic views provide the variables object and object_list as context. Therefore, you need to change your templates to match the new context variables. Go through your templates, and modify any reference to latest_poll_list to object_list, and change any reference to poll to object.

comment:2 by Jacob, 13 years ago

milestone: 1.0.3

Milestone 1.0.3 deleted

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