Opened 9 years ago
Last modified 8 years ago
#28082 closed Cleanup/optimization
BaseDateListView should pass all context to subclasses — at Version 2
| 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 (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 (2)
comment:1 by , 9 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 |
PR