1๐
โ
I would probably do something like this in your view
user_data.all = [user_data.x, user_data.y, ...]
user_data.any = any(user_data.all)
in the template
{% if user_data.any %}
{% for elem in user_data.all %}
<tr>
<th>{{ elem.title }}</th>
<td>{{ elem.data }}</td>
</tr>
{% endfor %}
{% endif %}
obviously that will only work if each element has.title and .data โ but you could add a property to each existing model to produce that data
๐คlukeaus
Source:stackexchange.com