class ListModelMixin
from rest_framework.mixins import ListModelMixin
Documentation
Source code
List a queryset.
Ancestors (MRO)
- ListModelMixin
Descendants
Methods used but not implemented in this class
- get_paginated_response
- paginate_queryset
- filter_queryset
- get_serializer
- get_queryset
Methods
def
list(self, request, *args, **kwargs):
ΒΆ
ListModelMixin
def list(self, request, *args, **kwargs):
queryset = self.filter_queryset(self.get_queryset())
page = self.paginate_queryset(queryset)
if page is not None:
serializer = self.get_serializer(page, many=True)
return self.get_paginated_response(serializer.data)
serializer = self.get_serializer(queryset, many=True)
return Response(serializer.data)