#17242: Kwargs are not in the context if you inherit from BaseListView or it's
subclasses
-------------------------+-------------------------------------------------
     Reporter:  Fact     |      Owner:  nobody
  Fiber                  |     Status:  new
         Type:  Bug      |    Version:  SVN
    Component:  Generic  |   Keywords:  generic views list baselistview
  views                  |  kwargs
     Severity:  Normal   |  Has patch:  1
 Triage Stage:           |      UI/UX:  0
  Unreviewed             |
Easy pickings:  1        |
-------------------------+-------------------------------------------------
 **Description**:

 The problem occurs when you inherit from BaseListView (or a view that
 inherits from it) and you assume that context contains kwargs. This is a
 fair assumption as MultipleObjectMixin.get_context_data() contains:

 {{{
 context.update(kwargs)
 }}}

 Kwargs should be passed to self.get_context_data() in BaseListView and
 they're not. Therefore the mentioned line of code code in
 MultipleObjectMixin doesn't have any effect.

 This looks like a bug as MultipleObjectMixin.get_context_data() which is
 exactly the one called in BaseListView uses kwargs to update the context,
 but the kwargs are not passed so this breaks the chain.

 **Steps to reproduce**:

 * Inherit from BaseListView (or its subclasses, e.g. ListView).
 * Update kwargs in your view
 * Kwargs should be available in the context

 **Proposed solution:**

 BaseListView's get() should pass kwargs to get_context_data()

 **Patch:**

 The proposed patch is attached

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

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to