Ticket #6898: templates_python.txt.diff
File templates_python.txt.diff, 1022 bytes (added by , 17 years ago) |
---|
-
templates_python.txt
1059 1059 1060 1060 Although you can pass any number of arguments to a template tag using 1061 1061 ``token.split_contents()``, the arguments are all unpacked as 1062 string literals. A little more work is required in order to dynamic content (a1063 template variable) to a template tag as an argument.1062 string literals. A little more work is required in order to pass dynamic 1063 content (a template variable) to a template tag as an argument. 1064 1064 1065 1065 While the previous examples have formatted the current time into a string and 1066 1066 returned the string, suppose you wanted to pass in a ``DateTimeField`` from an … … 1169 1169 In Python 2.4, the decorator syntax also works:: 1170 1170 1171 1171 @register.simple_tag 1172 def current_time( token):1172 def current_time(format_string): 1173 1173 ... 1174 1174 1175 1175 A couple of things to note about the ``simple_tag`` helper function: