#25854: Remove deprecated usage of template.render() with RequestContext in docs
-------------------------------+-----------------------------------------
     Reporter:  stephanm       |                    Owner:  alasdairnicol
         Type:  Bug            |                   Status:  new
    Component:  Documentation  |                  Version:  1.8
     Severity:  Normal         |               Resolution:
     Keywords:                 |             Triage Stage:  Accepted
    Has patch:  1              |      Needs documentation:  0
  Needs tests:  0              |  Patch needs improvement:  0
Easy pickings:  0              |                    UI/UX:  0
-------------------------------+-----------------------------------------
Changes (by alasdairnicol):

 * status:  closed => new
 * resolution:  fixed =>


Comment:

 I just noticed one more example that might need to be updated, in the
 [https://docs.djangoproject.com/en/1.9/ref/templates/api/#subclassing-
 context-requestcontext Subclassing RequestContext] section.

 {{{
 def some_view(request):
     # ...
     c = RequestContext(request, {
         'foo': 'bar',
     }, [ip_address_processor])
     return HttpResponse(t.render(c))
 }}}

 This snippet doesn't show how `t` was created, but it won't work if it
 used `loader.get_template`. I'm not sure whether/how we should change this
 section.

 In addition, I think that the
 [https://docs.djangoproject.com/en/1.9/ref/templates/api/#subclassing-
 context-requestcontext Subclassing RequestContext] could be improved
 slightly. I'm afraid it's just a thought and not a concrete patch at the
 moment, so it might be better to open a new ticket.

 There are many places in the docs where we say 'use a request context' and
 link to this section, but at the moment, we don't actually say *how* to
 use a request context. As we say on the
 [https://docs.djangoproject.com/en/1.9/ref/csrf/ csrf docs], the user
 should do one of:

  1. Use a contrib app
  2. Use the render shortcut
  3. Use a generic CBV
  4. pass request to template.render(context, request)

--
Ticket URL: <https://code.djangoproject.com/ticket/25854#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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/066.a173e8d30181887ec3663114a9cb5c2b%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to