[Answered ]-How to count how many records have minimum value in field? (Django)

2👍

You can do like this, not tried;

from django.db.models import Count

Product.objects.get(pk=1).offer_set.all().values('price').annotate(total=Count('price')).order_by('price')

Leave a comment