Opened 7 years ago

Closed 7 years ago

Last modified 5 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: UI/UX:


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

  1. polls/ 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 Changed 7 years ago by ubernostrum

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

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 Changed 5 years ago by jacob

  • milestone 1.0.3 deleted

Milestone 1.0.3 deleted

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