Ticket #7189: context_processors_in_direct_to_template.diff

File context_processors_in_direct_to_template.diff, 1.7 KB (added by Marat Radchenko <slonopotamusorama@…>, 17 years ago)
  • django/views/generic/simple.py

     
    22from django.template import loader, RequestContext
    33from django.http import HttpResponse, HttpResponsePermanentRedirect, HttpResponseGone
    44
    5 def direct_to_template(request, template, extra_context=None, mimetype=None, **kwargs):
     5def direct_to_template(request, template, extra_context=None, mimetype=None, context_processors=None, **kwargs):
    66    """
    77    Render a given template with any extra URL parameters in the context as
    88    ``{{ params }}``.
     
    1414            dictionary[key] = value()
    1515        else:
    1616            dictionary[key] = value
    17     c = RequestContext(request, dictionary)
     17    c = RequestContext(request, dictionary, context_processors)
    1818    t = loader.get_template(template)
    1919    return HttpResponse(t.render(c), mimetype=mimetype)
    2020
  • docs/generic_views.txt

     
    102102    * ``mimetype``: The MIME type to use for the resulting document. Defaults
    103103      to the value of the ``DEFAULT_CONTENT_TYPE`` setting.
    104104
     105    * ``context_processors``: A list of template-context processors to apply to
     106      the view's template. See the `RequestContext docs`_.
     107
    105108**Example:**
    106109
    107110Given the following URL patterns::
     
    818821
    819822An example of the use of pagination can be found in the `object pagination`_
    820823example model.
    821          
     824
    822825.. _`object pagination`: ../models/pagination/
    823826
    824827**New in Django development version:**
Back to Top