You can get the QuerySet with:
You should make a category model like this:
class Category(models.Model):
name = models.CharField(max_length=255, unique=True)
class Blog(DateTimeModel):
title = models.CharField(max_length=255)
description = models.TextField()
category = models.ForeignKey(Category, null=True)
Then you can annotate the Category objects, like:
from django.db.models import Count
Category.objects.annotate(
blog_count=Count('blog')
)