[Django] #33818: BaseListView get(...) loose kwargs calling self.get_context_data

24 views
Skip to first unread message

Django

unread,
Jul 1, 2022, 9:45:56 AM7/1/22
to django-...@googlegroups.com
#33818: BaseListView get(...) loose kwargs calling self.get_context_data
-----------------------------------------+------------------------------
Reporter: mariosgn | Owner: nobody
Type: Bug | Status: new
Component: Generic views | Version: 4.0
Severity: Normal | Keywords: BaseListView
Triage Stage: Unreviewed | Has patch: 1
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+------------------------------
In BaseListView in /views/generic/list.py the `get` function does not pass
`('**kwargs')` to `self.get_context_data` at line 174.

{{{
context = self.get_context_data()
return self.render_to_response(context)
}}}
I believe should be
{{{
context = self.get_context_data(**kwargs)
return self.render_to_response(context)
}}}

In my code there is this url pointing to a ListView
{{{
path('device/<int:device_id>/history', MyListView.as_view(),
name='my_view_name'),
}}}
and in the ListView the ```device_id``` is lost unless I add the
```**kwargs``` as shown above

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

Django

unread,
Jul 1, 2022, 5:31:10 PM7/1/22
to django-...@googlegroups.com
#33818: BaseListView get(...) loose kwargs calling self.get_context_data
---------------------------------+--------------------------------------
Reporter: Mario Signorino | Owner: ziyad00
Type: Bug | Status: assigned

Component: Generic views | Version: 4.0
Severity: Normal | Resolution:

Keywords: BaseListView | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------
Changes (by ziyad00):

* owner: nobody => ziyad00
* status: new => assigned


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

Django

unread,
Jul 1, 2022, 6:21:49 PM7/1/22
to django-...@googlegroups.com
#33818: BaseListView get(...) loose kwargs calling self.get_context_data
-------------------------------------+-------------------------------------
Reporter: Mario Signorino | Owner: Ziyad
| Alotaibi
Type: Bug | Status: closed

Component: Generic views | Version: 4.0
Severity: Normal | Resolution: duplicate

Keywords: BaseListView | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

* status: assigned => closed
* resolution: => duplicate


Comment:

Duplicate of #17242. The current behavior is intended. `TemplateView` adds
`kwargs` to context, but there's no plan to add that behavior to other
views (see #19878).

--
Ticket URL: <https://code.djangoproject.com/ticket/33818#comment:2>

Reply all
Reply to author
Forward
0 new messages