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
See https://docs.djangoproject.com/en/stable/ref/templates/builtins/#if : just use, to reproduce their example:
{% if athlete_list %} Number of athletes: {{ athlete_list|length }} {% else %} No athletes. {% endif %}