How can I check the size of a collection within a Django template?

前端 未结 7 1492
南旧
南旧 2020-12-12 21:31

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

相关标签:
7条回答
  • 2020-12-12 21:59

    If you tried myList|length and myList|length_is and its not getting desired results, then you should use myList.count

    0 讨论(0)
提交回复
热议问题