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_serializer
  • paginate_queryset
  • filter_queryset
  • get_queryset
  • get_paginated_response
Expand Collapse

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)