[Django]-How to get the count of objects in ManyToMany field in template

7👍

Assuming that your model is passed to the template as my_model, the correct syntax would be:

{{ my_model.followers.all.count }}

This behavior is explained in Django documentation.

👤Selcuk

Leave a comment