[Django] #21336: ListView doesnt work with context_object_name

14 views
Skip to first unread message

Django

unread,
Oct 25, 2013, 11:44:14 PM10/25/13
to django-...@googlegroups.com
#21336: ListView doesnt work with context_object_name
-------------------------------+--------------------
Reporter: anamsarfraz@… | Owner: nobody
Type: Uncategorized | Status: new
Component: Documentation | Version: 1.5
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
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.

--
Ticket URL: <https://code.djangoproject.com/ticket/21336>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Oct 26, 2013, 9:42:15 AM10/26/13
to django-...@googlegroups.com
#21336: ListView doesnt work with context_object_name
-------------------------------+--------------------------------------
Reporter: anamsarfraz@… | Owner: nobody
Type: Uncategorized | Status: closed
Component: Documentation | Version: 1.5
Severity: Normal | Resolution: worksforme
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by alasdair):

* status: new => closed
* needs_better_patch: => 0
* resolution: => worksforme
* needs_tests: => 0
* needs_docs: => 0


Comment:

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 [https://docs.djangoproject.com/en/1.4/topics/generic-views-migration
/#the-list-suffix-on-list-views 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

--
Ticket URL: <https://code.djangoproject.com/ticket/21336#comment:1>

Reply all
Reply to author
Forward
0 new messages