class ListModelMixin

from rest_framework.mixins import ListModelMixin
Documentation Source code
    List a queryset.
    

Ancestors (MRO)

  1. ListModelMixin

Methods used but not implemented in this class

  • get_pagination_serializer
  • filter_queryset
  • get_serializer
  • paginate_queryset
  • get_queryset
Expand Collapse

Methods

def list(self, request, *args, **kwargs): ΒΆ ListModelMixin

    def list(self, request, *args, **kwargs):
        instance = self.filter_queryset(self.get_queryset())
        page = self.paginate_queryset(instance)
        if page is not None:
            serializer = self.get_pagination_serializer(page)
        else:
            serializer = self.get_serializer(instance, many=True)
        return Response(serializer.data)