Opened 8 years ago
Closed 7 years ago
#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: | 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 (last modified by )
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 by , 8 years ago
Has patch: | set |
---|---|
Needs tests: | set |
Summary: | Pull request #8364: BaseDateListView should pass all context to subclasses → BaseDateListView should pass all context to subclasses |
Triage Stage: | Unreviewed → Accepted |
comment:3 by , 7 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:4 by , 7 years ago
Needs tests: | unset |
---|---|
Triage Stage: | Accepted → Ready for checkin |
PR with test.
PR