{% if is_loggedin OR is_anonymous %}
test message
{% endif %}
views:
68answers:
2
+4
A:
{% if is_loggedin or is_anonymous %}
test message
{% endif %}
Like that.
BJ Homer
2010-02-03 21:50:42
That doesn't work in the most recent release version (1.1). It's planed for 1.2 release, and indeed is present in the current development version. But for now you can use the custom "smart if" tag: http://www.djangosnippets.org/snippets/1350/
Ludwik Trammer
2010-02-03 22:06:12
It should work in the current one: http://docs.djangoproject.com/en/1.1/ref/templates/builtins/#if. I'm using it. Smart if adds comparisons (>, >=, <, <=, etc.).
BJ Homer
2010-02-03 23:30:56
+1
A:
if tags may use and, or or not to test a number of variables or to negate a given variable:
http://docs.djangoproject.com/en/dev/ref/templates/builtins/#if
The way you're doing it is fine. :-)
Nick Presta
2010-02-03 21:51:46
`{% ifequal page 5 %}`. In the dev brunch (leading to version 1.2) `{% if page == 5 %}` will also work.
Ludwik Trammer
2010-02-03 22:07:54