Opened 7 years ago

Last modified 7 years ago

#28082 closed Cleanup/optimization

Pull request #8364: BaseDateListView should pass all context to subclasses — at Initial Version

Reported by: Leon Matthews Owned by: nobody
Component: Generic views Version: dev
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

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 GitHub pull request https://github.com/django/django/pull/8364

(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 (0)

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