I'm new at django, and I need to get table row count (best it would be if before rendering table) of table which rendered with django table2 in my template
have some code like this:
{% load render_table from django_tables2 %}
{% block content %}
{% render_table participations_table %}
{% endblock %}
and I want to render this table if there is at least 1 row in it.
You can check if there are any rows using the table's
rowsattributeIn the django template, you can get the number of rows with the
lengthfilter.Or in the view, simply
Alternatively, you could decide to always display the table, and customize the
empty_textattribute which is displayed when the table is empty.