Django

Code

Changeset 3911

Show
Ignore:
Timestamp:
10/23/06 02:39:19 (2 years ago)
Author:
mtredinnick
Message:

Fixed #2837 -- Documented the context_instance parameter to
render_to_response().

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/docs/templates_python.txt

    r3901 r3911  
    312312        }, [ip_address_processor]) 
    313313 
     314Note:: 
     315    If you are using Django's ``render_to_response()`` shortcut to populate a 
     316    template with the contents of a dictionary, your template will be passed a 
     317    ``Context`` instance by default (not a ``RequestContext``). If you wish to 
     318    use a ``RequestContext`` in your template rendering, you need to pass an 
     319    optional third argument to ``render_to_response()``: a ``RequestContext`` 
     320    instance. Your code might look like this:: 
     321 
     322        def some_view(request): 
     323            # ... 
     324            return render_to_response('my_template'html', 
     325                                      my_data_dictionary, 
     326                                      context_instance = RequestContext(request)) 
     327 
    314328Here's what each of the default processors does: 
    315329