4👍
✅
You must doing something like this:
from django.db.models import Count
MyModel.objects.values('Type').annotate(dcount=Count('Type'))
MyModel.objects.values('Type__id').annotate(dcount=Count('Type__id'))
you can also read this document can help you….
good luck!
Source:stackexchange.com