Reputation: 661
I have this in my Django 1.2 template:
{% for m in model.related.iterator %}
{% if "str" or "Str" in m %}
{{m}}//I don't want anything here but put this in so I could see the output
{%else%}
{% if forloop.last %}
{% customtag "var" %}
{% endif %}
{% endif %}
{% endfor %}
I get the value of {{m}}
no matter if it contains "str"
, "Str"
or neither of them. Also, if I take out the or
and compare one string it works but I would like to compare both without another else if
. Any way to do that?
Upvotes: 1
Views: 89
Reputation: 1293
I believe what you want is
{% if "str" in m or "Str" in m %}
however, Glyn's answer would also work
Upvotes: 3