This is the code of home.html
:
This code is in my views.py
:
def home(request):
return render(request, 'home.html', {'age':'27'})
This is the templates html home.html
:
<td>
{% if age > 25 %}
<span>abc</span>
{% elif age > 30 %}
<span>def</span>
{% elif age > 35 %}
<span>ghi</span>
{% else %}
<span>others</span>
{% endif %}
</td>
You know in the home.html
, it will be others
, not abc
.
How to convert the string to int in the django templates language?