#17381: TemplateView get method passes kwargs into context
-------------------------------+--------------------------------------
Reporter: ptone | Owner: nobody
Type: Bug | Status: new
Component: Generic views | Version: SVN
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Comment (by ptone):
Perhaps this is all backseat, after the fact, design bikeshedding, but to
me a consistent behavior for get_context_data across all the class-based
views makes it easier to understand what the behavior of a subclass would
be when mixing together multiple parts of the class-based-view "toolkit"
This ticket is a near duplicate of #17228, in which I did recognize the
historical reason, though I didn't initially here. I guess the reason this
has come up for me multiple times is in working on #16074 and feeling like
there should be an idea of a "get_context_data" contract, so that a view
can call super across multiple classes and that there is a pattern that is
followed throughout about how context is built.
This deviation from what is otherwise a relatively regular pattern can
also throw people off about what should be the "default/standard" behavior
for CBV see #17242
Where as direct-to-template was only usable in the simplest of situations,
making a params context variable the primary method of customizing/tuning
- TemplateView acts as a perfectly extendable base class, and it would be
nice if it conformed a bit more to the pattern for get_context_data for
the sake of predictability and comprehensibility.
Alternately documenting TemplateView as a "endpoint only" as a transition
from direct-to-template, with a note to use the component mixins in a
custom base for a more complex set of CBVs
--
Ticket URL: <https://code.djangoproject.com/ticket/17381#comment:4>
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.