Ticket #4756: 4756.patch

File 4756.patch, 1.4 KB (added by Chris Beaven, 17 years ago)
  • docs/templates_python.txt

     
    315315            'foo': 'bar',
    316316        }, [ip_address_processor])
    317317
    318 Note::
     318Note:
    319319    If you're using Django's ``render_to_response()`` shortcut to populate a
    320320    template with the contents of a dictionary, your template will be passed a
    321321    ``Context`` instance by default (not a ``RequestContext``). To use a
     
    329329                                      my_data_dictionary,
    330330                                      context_instance=RequestContext(request))
    331331
     332    Or alternately, use the `simple generic view`_ ``direct_to_template()`` as a
     333    shortcut. It works similar to ``render_to_response()`` except it takes
     334    ``request`` as it's first argument and passes a ``RequestContext`` instance
     335    to the template::
     336
     337        def some_view(request):
     338            # ...
     339            return direct_to_template(request,
     340                                      'my_template.html',
     341                                      my_data_dictionary)
     342
     343.. _simple generic view: ../generic_views/#django-views-generic-simple-direct-to-template
     344
    332345Here's what each of the default processors does:
    333346
    334347.. _HttpRequest object: ../request_response/#httprequest-objects
Back to Top