The if in jinja2 is useful for know if a value is defined but I need to know if a query have results or not?
for example:
<thead>
{% if row in rows %} # this is a pseudo-code that i looking for
...
</thead>
<tbody>
{% for row in rows %}
...
</tbody>
rows is the result of a gql query where ‘no result’ is NULL but
{% if rows == NULL %}
or
{% if rows is none %}
don’t help me. I want to hide thead when tbody is empty.
Have you tried:
{% if rows %}?Edit: To keep thead from showing up for each row, put the if statement outside of your for loop. Something like: