#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 <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/071.8c33b8fb0ab03017c32a01743600102b%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to