diff options
| author | Joseph Kocherhans <joseph@jkocherhans.com> | 2006-01-13 18:27:40 +0000 |
|---|---|---|
| committer | Joseph Kocherhans <joseph@jkocherhans.com> | 2006-01-13 18:27:40 +0000 |
| commit | 9a9e2730bc9c5a5dbf087db7e5a24e8300bb7ea9 (patch) | |
| tree | 7dd3377be5fb0bc7d66517684e6a7a43a28a2f26 /docs/templates_python.txt | |
| parent | 042d1df0e74d2434a5dd2c40e766240d26d9b206 (diff) | |
magic-removal: Updated docs to reflect move/rename of DjangoContext.
git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@1951 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs/templates_python.txt')
| -rw-r--r-- | docs/templates_python.txt | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/docs/templates_python.txt b/docs/templates_python.txt index e01d48304c..71d94dbb5a 100644 --- a/docs/templates_python.txt +++ b/docs/templates_python.txt @@ -241,15 +241,15 @@ If you ``pop()`` too much, it'll raise Using a ``Context`` as a stack comes in handy in some custom template tags, as you'll see below. -Subclassing Context: DjangoContext +Subclassing Context: RequestContext ---------------------------------- Django comes with a special ``Context`` class, -``django.core.extensions.DjangoContext``, that acts slightly differently than +``django.template.RequestContext``, that acts slightly differently than the normal ``django.template.Context``. The first difference is that takes an `HttpRequest object`_ as its first argument. For example:: - c = DjangoContext(request, { + c = RequestContext(request, { 'foo': 'bar', } @@ -269,16 +269,16 @@ variable to the context and a second processor adds a variable with the same name, the second will override the first. The default processors are explained below. -Also, you can give ``DjangoContext`` a list of additional processors, using the +Also, you can give ``RequestContext`` a list of additional processors, using the optional, third positional argument, ``processors``. In this example, the -``DjangoContext`` instance gets a ``ip_address`` variable:: +``RequestContext`` instance gets a ``ip_address`` variable:: def ip_address_processor(request): return {'ip_address': request.META['REMOTE_ADDR']} def some_view(request): # ... - return DjangoContext({ + return RequestContext({ 'foo': 'bar', }, [ip_address_processor]) @@ -291,7 +291,7 @@ django.core.context_processors.auth ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ If ``TEMPLATE_CONTEXT_PROCESSORS`` contains this processor, every -``DjangoContext`` will contain these three variables: +``RequestContext`` will contain these three variables: * ``user`` -- An ``auth.User`` instance representing the currently logged-in user (or an ``AnonymousUser`` instance, if the client isn't @@ -309,7 +309,7 @@ django.core.context_processors.debug ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ If ``TEMPLATE_CONTEXT_PROCESSORS`` contains this processor, every -``DjangoContext`` will contain these two variables -- but only if your +``RequestContext`` will contain these two variables -- but only if your ``DEBUG`` setting is set to ``True`` and the request's IP address (``request.META['REMOTE_ADDR']``) is in the ``INTERNAL_IPS`` setting: @@ -323,7 +323,7 @@ django.core.context_processors.i18n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ If ``TEMPLATE_CONTEXT_PROCESSORS`` contains this processor, every -``DjangoContext`` will contain these two variables: +``RequestContext`` will contain these two variables: * ``LANGUAGES`` -- The value of the `LANGUAGES setting`_. * ``LANGUAGE_CODE`` -- ``request.LANGUAGE_CODE``, if it exists. Otherwise, |
