{{ is_true }}
{% if is_true == "True" %}
<h2>Say True</h2>
{% else %}
<h2> False </h2>
{% endif %}
But instead it went to else clause even though {{ is_true }} returns True
Any idea?
def some_func():
if ....:
return True
else:
return False
You don’t need to use
"True"in your template:Or just:
If you use
"True"in your template then you are comparing the booleanTruewith the string"True"(which are not the same) and end up in theelseclause of your template.In other words you would be doing:
You can find more info about Django’s Template Language in the documentation