summaryrefslogtreecommitdiff
path: root/docs/templates_python.txt
diff options
context:
space:
mode:
Diffstat (limited to 'docs/templates_python.txt')
-rw-r--r--docs/templates_python.txt11
1 files changed, 6 insertions, 5 deletions
diff --git a/docs/templates_python.txt b/docs/templates_python.txt
index 7171f32612..261eaedf74 100644
--- a/docs/templates_python.txt
+++ b/docs/templates_python.txt
@@ -277,7 +277,7 @@ Subclassing Context: RequestContext
Django comes with a special ``Context`` class,
``django.template.RequestContext``, that acts slightly differently than
-the normal ``django.template.Context``. The first difference is that takes
+the normal ``django.template.Context``. The first difference is that it takes
an `HttpRequest object`_ as its first argument. For example::
c = RequestContext(request, {
@@ -311,9 +311,10 @@ optional, third positional argument, ``processors``. In this example, the
def some_view(request):
# ...
- return RequestContext(request, {
+ c = RequestContext(request, {
'foo': 'bar',
}, [ip_address_processor])
+ return t.render(c)
Note::
If you're using Django's ``render_to_response()`` shortcut to populate a
@@ -673,11 +674,11 @@ If you are writing a template filter which only expects a string as the first
argument, you should use the included decorator ``stringfilter`` which will convert
an object to it's string value before being passed to your function::
- from django import template
+ from django.template.defaultfilters import stringfilter
- @template.stringfilter
+ @stringfilter
def lower(value):
- return value.lower()
+ return value.lower()
Writing custom template tags
----------------------------