#28943: Avoid the need to call get_context_data() in TemplateView subclasses
-------------------------------------+-------------------------------------
Reporter: James Pic | Owner: nobody
Type: | Status: closed
Cleanup/optimization |
Component: Generic views | Version: 2.0
Severity: Normal | Resolution:
| worksforme
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 James Pic):
> Unless I missed something, super().get() will call the TemplateView
implementation, even if you override get() in a subclass.
That's True unless YourFooDetailView inherits from YourProjectDetailView
which would inherit from django.views.generic.DetailView.
When you work as a Django user, you often want to add a project-specific
layer between your actual user facing views and django views, ie. to
refactor common features you have in all your
{List,Detail,Update,Create,Form,Object,Model}View classes accross the
project's app.
And anyway, I think get_context_data() deserves to be removed from
Django's public API, this is made to support legacy templates, new
templates just use {{ view.object }} than {{ object }} because then they
make @object a memoized property which they can always use in
{dispatch,get,post,delete,options} methods instead of thinking they're
paid by the quantity of lines of code and take pride in overriding and
decorating get_context_data() for no reason thanks to the visionary who
made view=self a default in CBV.
Maybe what I'm saying doesn't make any sense to anybody than myself lol
but at least you can point-godwin me because i don't consider the
resolution of this ticket worksforme, but don't take it personnaly, you
know i still admire you from the deepest of my heart Tim <3
With LOVE
∞
--
Ticket URL: <https://code.djangoproject.com/ticket/28943#comment:16>
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/062.eeb05db01e19d1cef47c4727ddd9afe4%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.