tags:

views:

68

answers:

2
{% if is_loggedin OR is_anonymous %}
test message
{% endif %}
+4  A: 
{% if is_loggedin or is_anonymous %}
test message
{% endif %}

Like that.

BJ Homer
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
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
+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
Thanks. How do I do {% if page = 5 %} ?
TIMEX
`{% ifequal page 5 %}`. In the dev brunch (leading to version 1.2) `{% if page == 5 %}` will also work.
Ludwik Trammer
This would work with strings too?
TIMEX
it'll work with anything
Dmitry Shevchenko