[Answered ]-Count objects assigned to the category in a django cycle

2👍

Assuming the objects attached to your categories are called Adverts:

{% for categ in categs %}

    {{ categ.name }} ({{ categ.advert_set.count }})

{% endfor %}

If you changed the attribute related_name of your Adverts in the Category ModelClass in your models.py file you’ll have to adjust advert_set to the corresponding related_name.

For more information about how to access related objects take a look at the docs.

Leave a comment