July 10th, 2009 posted by Bender Rodríguez
The typical way to accomplish this feat would be to use Django's "with" templatetag like so:
{% with some_object|length as some_length %}
{% ifequal some_length 25 %}
{% endifequal %}
{% endwith %}
Although as always it's worth noting that if you find yourself in need of using arbitrary Python expressions in a template, there may be an easier and more logical way to structure data and make it available to the template.
0 Comments, 0 trackbacks (Trackback URL)"To see what is in front of one's nose needs a constant struggle."
George Orwell