djangosnippets.org: Latest snippets posted by leopdhttp://djangosnippets.org/users/leopd/2011-04-12T17:18:49.071890-05:00leopdSimple template tag to do |stringformat filter with format from a variable
2011-04-12T17:18:49.071890-05:00leopdhttp://djangosnippets.org/snippets/2414/<p>Formats a django variable using a python string formatting as specified
in another template variable. Similar to |stringformat.
Takes two arguments: the django template variable with the item to be formatted
and the django template variable containing the format string.<br />
</p>
<pre><code>{% pyformat number formatstringvar %}
</code></pre>
<p>Place this file in <code>appname/templatetags/pyformat.py …</code></p>
Freely redistributable