Home > OS >  How to check whether the Html value is 1 in Django?
How to check whether the Html value is 1 in Django?

Time:11-28

home.html

        {% if  stud.scrapper_status == 1 %}
          <td>{{stud.scrapper_status}} --> Started</td>
        {% else %}
          <td>{{stud.scrapper_status}} --> Completed</td>
        {% endif %}

Output Image

If my value is 1 I should get started but for all the value its getting Completed, How to check the value if 1 or not in html.

CodePudding user response:

It should be "1" not 1 so:

home.html

        {% if  stud.scrapper_status == "1" %}
          <td>{{stud.scrapper_status}} --> Started</td>
        {% else %}
          <td>{{stud.scrapper_status}} --> Completed</td>
        {% endif %}
  • Related