Django access the length of a list within a template Django access the length of a list within a template django django

Django access the length of a list within a template


Use list|length. | indicates that you will use a filter. The size of the list is

{{ list|length }}


{% if your_list %}{{ your_list|length }}{% endif %}

Just remember that if your_list is a property it will be tigger on this line, so if you make dynamic list that is created each time you ask for it and you want to for later you will trigger it twice;