# 按author表的所有字段 group by
queryResult=Author.objects .annotate(SumPrice=Sum("book__price")) .values_list("name","SumPrice")
print(queryResult)
# 按authors__name group by
queryResult2=Book.objects.values("authors__name") .annotate(SumPrice=Sum("price")) .values_list("authors__name","SumPrice")
print(queryResult2)
values的参数相当于group by分组