A Django query to find top 3 posts with maximum comments

how can i find the top 3 blogpost with the maximum comments
here are my models:

 class BlogPost(models.Model):
    title = models.CharField(max_length=250)
    body = models.TextField()
class Comments(models.Model):
    post = models.ForeignKey('BlogPost', null=False, on_delete=models.CASCADE)
    comment = models.TextField()

Answer

This will give you the top 3 posts along with number of comments (dcount) grouped by posts.

from django.db.models import Count

Comments.objects.values('post').annotate(dcount=Count('id')).order_by('-dcount')[:3]