#28082 closed Cleanup/optimization (fixed)

BaseDateListView should pass all context to subclasses

Reported by: Leon Matthews Owned by: Sebastián Sassi
Component: Generic views Version: master
Severity: Normal Keywords: BaseDateListView
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Leon Matthews)

Pass the extra_content from get_dated_items() as kwargs into get_context_data() to allow users access to it.

BaseDateListView.get() currently modifies the context after calling get_context_data(), which prevents users from access those data in their base classes. I ran into this suprising quirk when I wanted to access the current month in my MonthArchiveView subclass's get_context_data().

I have created a pull request for a very minimal patch.

(To really tidy things up, we could have all instances get_dated_items() return a single dictionary that we pass to get_context_data as kwargs, but I am a realist on occasion...)

Change History (5)

comment:1 Changed 14 months ago by Claude Paroz

Has patch: set
Needs tests: set
Summary: Pull request #8364: BaseDateListView should pass all context to subclassesBaseDateListView should pass all context to subclasses
Triage Stage: UnreviewedAccepted

comment:2 Changed 14 months ago by Leon Matthews

Description: modified (diff)

Linked to pull request as requested.

comment:3 Changed 10 months ago by Sebastián Sassi

Owner: changed from nobody to Sebastián Sassi
Status: newassigned

comment:4 Changed 10 months ago by Tim Graham

Needs tests: unset
Triage Stage: AcceptedReady for checkin

PR with test.

comment:5 Changed 10 months ago by Tim Graham <timograham@…>

Resolution: fixed
Status: assignedclosed

In 58483052:

Fixed #28082 -- Made BaseDateListView pass context from get_dated_items() to subclasses.

Thanks leon-matthews for the report and fix.

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