我正在为QuerySet中的每个项生成聚合:
def get_queryset(self): from django.db.models import Count queryset = Book.objects.annotate(Count('authors')) return queryset
但我没有得到JSON响应中的计数.
先感谢您.
python django django-rest-framework
django ×1
django-rest-framework ×1
python ×1