Q:

OR condition in django templates

Is there a way to implement conditional OR inside templates?
{% if %} would see if true or not...but what i'm looking for is
to implement smthing when {% if %} OR {% if %}..thanks

A:

in Django 1.2, you can use OR inside an IF tag...see the built-in template tags
{% if var1 == 'val1' or var2 == 'val2' %}

A:

You can use the firstof template tag. It works similar to an "or":
var1 or var2

will use var1, if it is True or var2, if it is False. Exacly like this statement in the template:
{% firstof var1 var2 %}

