Keyword arguments passed to ListView.as_view() in urlconf ignored, django 1.5.4

76 views
Skip to first unread message

Chang Sun

unread,
Oct 29, 2013, 9:51:06 AM10/29/13
to django...@googlegroups.com
code segment 1:

url(r'^some_url$', SomeTemplateView.as_view(), {'tab': 'index'}),

the 'tab' variable can be fetched in the template
while in

code segment 2:

url(r'^some_url$', SomeListView.as_view(), {'tab': 'index'}),

the 'tab' variable is missing in the template.

I found that in Lib\site-packages\django\views\generic\list.py
in line 139         context = self.get_context_data(object_list=self.object_list)
the **kwargs are not passed to self.get_context_data

Could this be regarded as a bug of django 1.5.4?

Appreciate any responses!

tim

unread,
Oct 29, 2013, 10:30:45 AM10/29/13
to django...@googlegroups.com
I don't think so. There is actually a ticket to discontinue this behavior on the CBVs that do it: https://code.djangoproject.com/ticket/19878

Chang Sun

unread,
Oct 29, 2013, 10:01:46 PM10/29/13
to django...@googlegroups.com
Thank you for your reply, Tim.

This behavior confuses new users of CBVs. It takes time to learn it.


--
You received this message because you are subscribed to a topic in the Google Groups "Django users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/kC46bU-R-6k/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/edb4b990-9e67-409b-8252-9d606d48120c%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply all
Reply to author
Forward
0 new messages