from django.db.models.functions import Coalesce answers = Answer.objects.filter( ) .annotate(score=Coalesce(Sum('vote__type'), 0)) .order_by('-score')
確定! 回上一頁