Author: adrian
Date: 2007-09-13 23:04:51 -0500 (Thu, 13 Sep 2007)
New Revision: 6159
Modified:
django/trunk/docs/templates_python.txt
Log:
Edited docs/templates_python.txt change from [6143]
Modified: django/trunk/docs/templates_python.txt
===================================================================
--- django/trunk/docs/templates_python.txt 2007-09-14 04:00:12 UTC (rev
6158)
+++ django/trunk/docs/templates_python.txt 2007-09-14 04:04:51 UTC (rev
6159)
@@ -642,12 +642,12 @@
"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 @@
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
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---