summaryrefslogtreecommitdiff
path: root/docs/templates_python.txt
diff options
context:
space:
mode:
authorAdrian Holovaty <adrian@holovaty.com>2007-09-15 21:34:09 +0000
committerAdrian Holovaty <adrian@holovaty.com>2007-09-15 21:34:09 +0000
commitbf6a46d8ad11d49990a3878166cce2af2fc6c4fe (patch)
treeb24514e1780e8ec80afb9f295005e196af460f15 /docs/templates_python.txt
parentfb6a0c8ffa1cd74c63aaf4b011665e5952d449e7 (diff)
queryset-refactor: Merged to [6190]
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6334 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs/templates_python.txt')
-rw-r--r--docs/templates_python.txt14
1 files changed, 9 insertions, 5 deletions
diff --git a/docs/templates_python.txt b/docs/templates_python.txt
index 150aa70fdf..3399639611 100644
--- a/docs/templates_python.txt
+++ b/docs/templates_python.txt
@@ -642,12 +642,12 @@ your function. Example::
"Converts a string into all lowercase"
return value.lower()
-Template filters which expect strings
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Template filters that expect strings
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-If you're writing a template filter which only expects a string as the first
-argument, you should use the included decorator ``stringfilter``. This will
-convert an object to it's string value before being passed to your function::
+If you're writing a template filter that only expects a string as the first
+argument, you should use the decorator ``stringfilter``. This will
+convert an object to its string value before being passed to your function::
from django.template.defaultfilters import stringfilter
@@ -655,6 +655,10 @@ convert an object to it's string value before being passed to your function::
def lower(value):
return value.lower()
+This way, you'll be able to pass, say, an integer to this filter, and it
+won't cause an ``AttributeError`` (because integers don't have ``lower()``
+methods).
+
Registering a custom filters
~~~~~~~~~~~~~~~~~~~~~~~~~~~~