Opened 11 years ago

Closed 11 years ago

#21336 closed Uncategorized (worksforme)

ListView doesnt work with context_object_name

Reported by: anamsarfraz@… Owned by: nobody
Component: Documentation Version: 1.5
Severity: Normal 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

I read in the documentation that the template_object_name has been replaced with context_object_name. But when I try to get the ListView of a model, it doesnt work with context_object_name but works with template_object_name. I also tried the DetailView. In DetailView, it seems that replacement has been done because I got an error when I tried to use template_object_name but DetailView worked as expected with context_object_name.

Change History (1)

comment:1 by alasdair, 11 years ago

Resolution: worksforme
Status: newclosed

template_object_name was definitely replaced with context_object_name when changing from function to class-based generic views.

If you grep the source code for 1.5, you can see that template_object_name does not appear any where in the code:

[django]$ git checkout 1.5
HEAD is now at b170c07... [1.5.x] Correct final element of version tuple.
[django]$ git grep template_object_name
[django]$ 

Note the warning in the docs that the template_object_name was appended with the suffix '_list', but in a class-based ListView, the context_object_name is used verbatim.

If you need further help please see https://code.djangoproject.com/wiki/TicketClosingReasons/UseSupportChannels

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