Answers for "django rest framework datatables does not paginate"

1

django rest framework datatables does not paginate

# filter your queryset here. 
# than give it to self.queryset = your filtered queryset

queryset = self.filter_queryset(self.queryset) # this to enable sorting and search capabilities

# this to paginate whats left of filters
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)
#
Posted by: Guest on June-28-2021

Code answers related to "django rest framework datatables does not paginate"

Python Answers by Framework

Browse Popular Code Answers by Language