Quantcast

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

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

Django
#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.

--
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/056.c0f0cc4d00bb09045de940bbf3f564f7%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

Django
#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 <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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/071.80ccf5cfaebaf0ba41e52e2bcb226af4%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Django] #28082: BaseDateListView should pass all context to subclasses

Django
In reply to this post by Django
#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 [hidden email].
To post to this group, send email to [hidden email].
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.
Loading...