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)"What we are doing to the forests of the world is but a mirror reflection of what we are doing to ourselves and to one another."
Mohandas Karamchand Gandhi