1
0
mirror of https://github.com/django/django.git synced 2025-07-04 17:59:13 +00:00

[1.1.X] Fixed #11889: Documented the fact that context processors will overwrite pre-existing context variables of the same names. Backport of [12669] from trunk.

git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.1.X@12670 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
James Bennett 2010-03-03 08:44:22 +00:00
parent bca50d20d3
commit 7adae30286

View File

@ -318,6 +318,13 @@ 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 name, the second will override the first. The default processors are explained
below. below.
.. admonition:: When context processors are applied
When you use ``RequestContext``, the variables you supply directly
are added first, followed any variables supplied by context
processors. This means that a context processor may overwrite a
variable you've supplied, so take care to avoid variable names
which overlap with those supplied by your context processors.
Also, you can give ``RequestContext`` 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 optional, third positional argument, ``processors``. In this example, the
``RequestContext`` instance gets a ``ip_address`` variable:: ``RequestContext`` instance gets a ``ip_address`` variable::