I am generating a table using the jinja2 notation, within a flask app querying data from a MySQL database.
The html template:
{% for j in JRN %}
<tr>
<td>{{ j[0] }}</td>
{% if j[1] != '0000-00-00' %}
<td>{{ j[1] }}</td>
{% else %}
<td></td>
{% endif %}
...
{% endfor %}
Where Date, j[1]
, is null, or ‘0000-00-00’, I would like the table to be blank, rather than ‘None’.
The Date
field is of type: date
In addition to the if clause shown above, I have tried:
...
{% elif j[1] != '0' %}
<td>{{ j[1] }}</td>
{% elif j[1] != 0 %}
<td>{{ j[1] }}</td>
{% elif j[1] != 'None' %}
<td>{{ j[1] }}</td>
{% elif j[1] != 'NULL' %}
<td>{{ j[1] }}</td>
{% else %}
<td></td>
...
Thanks for your help