diff options
| author | Justin Bronn <jbronn@gmail.com> | 2008-06-26 15:11:55 +0000 |
|---|---|---|
| committer | Justin Bronn <jbronn@gmail.com> | 2008-06-26 15:11:55 +0000 |
| commit | aef8a8305d2190b00386b8b1603deb03a2949f5b (patch) | |
| tree | 65cce0fdb1f12e4e03384a1be8530da46051fcfa /docs/templates_python.txt | |
| parent | 9fcc6c305a562b2e622049d4ce8b6148a2c617ca (diff) | |
gis: Merged revisions 7643-7662,7667-7668,7672-7682,7686-7693,7695-7698,7700-7702,7704-7706,7710,7712-7729,7731-7732,7738-7758,7760-7766 via svnmerge from trunk.
git-svn-id: http://code.djangoproject.com/svn/django/branches/gis@7768 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs/templates_python.txt')
| -rw-r--r-- | docs/templates_python.txt | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/docs/templates_python.txt b/docs/templates_python.txt index 43ef016ed4..a03ea215d2 100644 --- a/docs/templates_python.txt +++ b/docs/templates_python.txt @@ -1059,8 +1059,8 @@ Passing template variables to the tag Although you can pass any number of arguments to a template tag using ``token.split_contents()``, the arguments are all unpacked as -string literals. A little more work is required in order to dynamic content (a -template variable) to a template tag as an argument. +string literals. A little more work is required in order to pass dynamic +content (a template variable) to a template tag as an argument. While the previous examples have formatted the current time into a string and returned the string, suppose you wanted to pass in a ``DateTimeField`` from an @@ -1169,10 +1169,11 @@ Our earlier ``current_time`` function could thus be written like this:: In Python 2.4, the decorator syntax also works:: @register.simple_tag - def current_time(token): + def current_time(format_string): ... A couple of things to note about the ``simple_tag`` helper function: + * Checking for the required number of arguments, etc, has already been done by the time our function is called, so we don't need to do that. * The quotes around the argument (if any) have already been stripped away, |
