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...)
--
Ticket URL: <https://code.djangoproject.com/ticket/28082>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* has_patch: 0 => 1
* needs_tests: 0 => 1
* stage: Unreviewed => Accepted
Comment:
[https://github.com/django/django/pull/8364/files PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/28082#comment:1>
Old 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...)
New 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 [https://github.com/django/django/pull/8364 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...)
--
Comment (by Leon Matthews):
Linked to pull request as requested.
--
Ticket URL: <https://code.djangoproject.com/ticket/28082#comment:2>
* owner: nobody => Sebastián Sassi
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/28082#comment:3>
* needs_tests: 1 => 0
* stage: Accepted => Ready for checkin
Comment:
[https://github.com/django/django/pull/8927 PR] with test.
--
Ticket URL: <https://code.djangoproject.com/ticket/28082#comment:4>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"5848305218a08eb0c0a32086813d14dc6f46b463" 58483052]:
{{{
#!CommitTicketReference repository=""
revision="5848305218a08eb0c0a32086813d14dc6f46b463"
Fixed #28082 -- Made BaseDateListView pass context from get_dated_items()
to subclasses.
Thanks leon-matthews for the report and fix.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/28082#comment:5>