djangosnippets.org: Latest snippets posted by romain-hardouinhttps://djangosnippets.org/users/romain-hardouin/2008-06-11T15:46:52.961222-05:00romain-hardouinVerbose template filter : avoid too many if
2008-06-11T15:46:52.961222-05:00romain-hardouinhttps://djangosnippets.org/snippets/795/<p>This tiny template filter saves you the tedious test "if this variable is set, print this text based on this variable".</p>
<p>'verbose' filter takes one parameter : a string containing '%s' which is a placeholder for the value to test. Check those examples :</p>
<ul>
<li>
<p>Replace this :</p>
<p>{% if name …</p></li></ul>
Freely redistributable