#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 Ziyad Alotaibi, 23 months ago

Owner: changed from nobody to Ziyad Alotaibi
Status: newassigned

comment:2 by Tim Graham, 23 months ago

Resolution: duplicate
Status: assignedclosed

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).

Note: See TracTickets for help on using tickets.
Back to Top