#28943: Avoid the need to call get_context_data() in TemplateView subclasses
-------------------------------------+-------------------------------------
     Reporter:  James Pic            |                    Owner:  nobody
         Type:                       |                   Status:  new
  Cleanup/optimization               |
    Component:  Generic views        |                  Version:  2.0
     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 Tim Graham):

 Is there a reason to duplicate the `render_to_response()` call in
 `post()`? I didn't test it, but I believe you could write both examples
 as:
 {{{
 class YourView(TemplateView):
     def post(self, request, *a, **k):
         if not self.dostuff():
             return http.HttpResponseBadRequest()

         return super().get(request, *a, **k)
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/28943#comment:11>
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.db7dc882dc2e1389b408fd2534f8348a%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to