A smarter {% if %} tag for django templates.
While retaining current Django functionality, it also handles equality, greater than and less than operators. Some common case examples:
{% if articles|length >= 5 %}...{% endif %}
{% if "ifnotequal tag" != "beautiful" %}...{% endif %}
Bases: object
Bases: object
alias of ValueError
Returns either a variable by itself or a non-boolean operation (such as x == 0 or x < 0).
This is needed to keep correct precedence for boolean operations (i.e. x or x == 0 should be x or (x == 0), not (x or x) == 0).
Bases: django.template.Node
Bases: unittest.TestCase
Test a calculation is True, also checking the inverse “negate” case.
Test a calculation is False, also checking the inverse “negate” case.
Bases: askbot.templatetags.smart_if.IfParser
alias of TemplateSyntaxError
Bases: object
A basic self-resolvable object similar to a Django template variable. Used to assist with tests.
A smarter {% if %} tag for django templates.
While retaining current Django functionality, it also handles equality, greater than and less than operators. Some common case examples:
{% if articles|length >= 5 %}...{% endif %}
{% if "ifnotequal tag" != "beautiful" %}...{% endif %}
Arguments and operators _must_ have a space between them, so {% if 1>2 %} is not a valid smart if tag.
All supported operators are: or, and, in, = (or ==), !=, >, >=, < and <=.