TIMEX
TIMEX

Reputation: 272094

How do I do "or" in Django template code?

{% if is_loggedin OR is_anonymous %}
test message
{% endif %}

Upvotes: 0

Views: 152

Answers (2)

Nick Presta
Nick Presta

Reputation: 28695

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. :-)

Upvotes: 1

BJ Homer
BJ Homer

Reputation: 49034

{% if is_loggedin or is_anonymous %}
test message
{% endif %}

Like that.

Upvotes: 4

Related Questions