0

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?

qg_java_17137
  • 3,310
  • 10
  • 41
  • 84

0 Answers0