Opened 3 years ago
Closed 3 years ago
#33818 closed Bug (duplicate)
BaseListView get(...) loose kwargs calling self.get_context_data
| Reported by: | Mario Signorino | Owned by: | Ziyad Alotaibi | 
|---|---|---|---|
| Component: | Generic views | Version: | 4.0 | 
| Severity: | Normal | Keywords: | BaseListView | 
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | yes | Needs documentation: | no | 
| Needs tests: | no | Patch needs improvement: | no | 
| Easy pickings: | no | UI/UX: | no | 
Description
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 
Change History (2)
comment:1 by , 3 years ago
| Owner: | changed from to | 
|---|---|
| Status: | new → assigned | 
comment:2 by , 3 years ago
| Resolution: | → duplicate | 
|---|---|
| Status: | assigned → closed | 
  Note:
 See   TracTickets
 for help on using tickets.
    
Duplicate of #17242. The current behavior is intended.
TemplateViewaddskwargsto context, but there's no plan to add that behavior to other views (see #19878).