elif
is supported since django 1.4
it may be that you are using an older version of django.
see my comment regarding the =
sign that is supposed to be ==
to evaluate to True or False as expected. Or you can use the ifequal
template tag instead.