Turn off automatic pagination of Django Rest Framework ModelViewSet
And if you want paginator disabled for just one action:
@property
def paginator(self):
self._paginator = super(NotesViewSet, self).paginator
if self.action == 'the_action_you_want_pagination_disabled':
self._paginator = None
return self._paginator
use this in your ModelViewSet
.
ModelViewSet or mixins.ListModelMixin automatically create pagination for us. You can stop it by paginator = None
class NotesViewSet(viewsets.ModelViewSet):
queryset = Notes.objects.all()
serializer_class = NotesWriteSerializer
paginator = None
If you are using recent versions of DRF you just need to add pagination_class = None
to your ModelViewSet
definition.
class MyClassBasedView(ModelViewSet):
pagination_class = None
...
You also can see some tips here https://github.com/tomchristie/django-rest-framework/issues/1390