#17228: params context variable is from TemplateView is inconsistent with other
get_context_data implementations
--------------------------------------+--------------------
     Reporter:  ptone                 |      Owner:  nobody
         Type:  Cleanup/optimization  |     Status:  new
    Component:  Generic views         |    Version:  SVN
     Severity:  Normal                |   Keywords:
 Triage Stage:  Unreviewed            |  Has patch:  0
Easy pickings:  0                     |      UI/UX:  0
--------------------------------------+--------------------
 The general pattern of get_context_data is to return a context dictionary
 where the kwargs passed to the method are used to update the context.

 This pattern is true for all classes that implement get_context_data
 except for TemplateView, which adds all the kwargs as a 'params' item.

 This is as documented but is inconsistent and makes it trickier to finish
 up work on #16074 which requires that all implementations of
 get_context_data call super.

 The cleanest design would be a pattern of:

 {{{
 def get_context_data(self, **kwargs):
     context = super(.... )(kwargs)
     # class specific stuff here
     return context
 }}}

 I propose that the use of a params item be deprecated, removed from the
 docs, and preserved through deprecation by both updating the context with
 kwargs, and defining the explicit 'params' item in TemplateView.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/17228>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to