[Django] #28082: Pull request #8364: BaseDateListView should pass all context to subclasses

8 views
Skip to first unread message

Django

unread,
Apr 16, 2017, 7:49:04 PM4/16/17
to django-...@googlegroups.com
#28082: Pull request #8364: BaseDateListView should pass all context to subclasses
-------------------------------------+-------------------------------------
Reporter: leon- | Owner: nobody
matthews |
Type: | Status: new
Cleanup/optimization |
Component: Generic | Version: master
views |
Severity: Normal | Keywords: BaseDateListView
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
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...)

--
Ticket URL: <https://code.djangoproject.com/ticket/28082>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Apr 17, 2017, 5:26:34 AM4/17/17
to django-...@googlegroups.com
#28082: BaseDateListView should pass all context to subclasses
--------------------------------------+------------------------------------
Reporter: Leon Matthews | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Generic views | Version: master
Severity: Normal | Resolution:
Keywords: BaseDateListView | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Claude Paroz):

* 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>

Django

unread,
Apr 20, 2017, 7:25:47 PM4/20/17
to django-...@googlegroups.com
#28082: BaseDateListView should pass all context to subclasses
--------------------------------------+------------------------------------
Reporter: Leon Matthews | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Generic views | Version: master
Severity: Normal | Resolution:
Keywords: BaseDateListView | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------

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>

Django

unread,
Aug 17, 2017, 2:20:08 PM8/17/17
to django-...@googlegroups.com
#28082: BaseDateListView should pass all context to subclasses
-------------------------------------+-------------------------------------
Reporter: Leon Matthews | Owner: Sebastián
Type: | Sassi
Cleanup/optimization | Status: assigned

Component: Generic views | Version: master
Severity: Normal | Resolution:
Keywords: BaseDateListView | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Sebastián Sassi):

* owner: nobody => Sebastián Sassi
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/28082#comment:3>

Django

unread,
Sep 4, 2017, 10:50:10 AM9/4/17
to django-...@googlegroups.com
#28082: BaseDateListView should pass all context to subclasses
-------------------------------------+-------------------------------------

Reporter: Leon Matthews | Owner: Sebastián
Type: | Sassi
Cleanup/optimization | Status: assigned
Component: Generic views | Version: master
Severity: Normal | Resolution:
Keywords: BaseDateListView | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

* 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>

Django

unread,
Sep 4, 2017, 11:10:17 AM9/4/17
to django-...@googlegroups.com
#28082: BaseDateListView should pass all context to subclasses
-------------------------------------+-------------------------------------

Reporter: Leon Matthews | Owner: Sebastián
Type: | Sassi
Cleanup/optimization | Status: closed

Component: Generic views | Version: master
Severity: Normal | Resolution: fixed

Keywords: BaseDateListView | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham <timograham@…>):

* 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>

Reply all
Reply to author
Forward
0 new messages