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')
Source:stackexchange.com