Reputation: 341
I am trying to use an if condition in html using jinja code, The Boolean value called "is_verified" is false. But the code prints exactly opposite of what it is expected to do, What's going wrong here?
{% for info in infos %}
{% if info.is_verified == "false" %}
<h4>Verification status: PENDING</h4>
{% else %}
<h4>Verification status: APPROVED</h4>
{% endif %}
{% endfor %}
Upvotes: 0
Views: 172
Reputation: 5075
You are comparing it with a string "false". Instead, use this;
{% for info in infos %}
{% if info.is_verified %}
<h4>Verification status: APPROVED</h4>
{% else %}
<h4>Verification status: PENDING</h4>
{% endif %}
{% endfor %}
Upvotes: 3