Well, im out my mind of what jeje .... how ill evaluate a variable with {% if %} in template?
im trying this
{% if variable > 0 %} or {% if variable != 0 %}
but...i got errors :(
Thanks
Well, im out my mind of what jeje .... how ill evaluate a variable with {% if %} in template?
im trying this
{% if variable > 0 %} or {% if variable != 0 %}
but...i got errors :(
Thanks
You should use
{% ifnotequal...
{% ifequal...
etc :)
Here is all: http://docs.djangoproject.com/en/dev/topics/templates/#topics-templates
Check out Django smart-if template tag http://simonwillison.net/2009/Mar/3/smartif/ http://www.djangosnippets.org/snippets/1350/
It replaces the built-in if tag and lets you do comparison operators.
Instead of continually posting here every time you have a minor problem, you should read Django's excellent documentation. In particular, the template docs have a very good explanation of why what you have tried is not allowed.
In this case, you could benefit from the fact that in Python 0 is the same as False. So you could have
{% if variable %}
or
{% if not variable %}
Otherwise, use {% ifequal %}
and {% ifnotequal %}
as MaRiz explains.