How to make column appear when condition satisfied in jinja2 templating

I have a table, where some column are condition specific. I want if the condition is satisfied only then show the column, otherwise, remove the column. How can i do that with jinja2 templating?

Here is an example. Just use the IF-Condition within the column to decide how to fill the column:

<table>
{% for drink in drinks %}
<tr>
 <td>{{ drink.name }}</td>
 <td>
 {% if drink.empty %}
   empty
 {% else %}
   full
 {% endif %}
 </td>
</tr>
{%endfor%}
</table>
Back to Top