I have a list in my Django template. I want to do something only if the size of the list is greater than zero.
I have tried myList|length and m
myList|length
m
A list is considered to be False if it has no elements, so you can do something like this:
False
{% if mylist %} I have a list! {% else %} I don't have a list! {% endif %}
I have a list!
I don't have a list!