I am rendering a formset in a template. How can I write a condition such that the page displays the sentence "Nothing to show" if the formset has no elements?
The following does not work:
{% if formset %}
{{ formset }}
{% else %}
<p>Nothing to show</p>
{% endif %}
I just found the answer by myself... It works with formset.forms
:
{% if formset.forms %}
{{ formset }}
{% else %}
<p>Nothing to show</p>
{% endif %}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With