Django-rest-framework: How to turn off pagination?

Created on 20 Mar 2015  路  2Comments  路  Source: encode/django-rest-framework

I am sorry if this is a silly question. But I could not find how to disable pagination. I am using LimitOffsetPagination as my default pagination class. I was to disable pagination in some views. To disable pagination I am setting paginate_by and paginate_by_param to None. But it is not working and I am not able to find a specific solution in docs. Can you please suggest how to disable pagination on some views while using the default on others?

Most helpful comment

I'm waiting for a good solution as well. But the following solution worked for me

def paginate_queryset(self, queryset, view=None):
    # couldn't find a better solution
    return None

Override paginate_queryset to return None.

Thanks
Ankit

All 2 comments

I'm waiting for a good solution as well. But the following solution worked for me

def paginate_queryset(self, queryset, view=None):
    # couldn't find a better solution
    return None

Override paginate_queryset to return None.

Thanks
Ankit

Setting page_size to 0 should do.
Also please use the mailing list, irc or stack overflow for usage questions

Was this page helpful?
0 / 5 - 0 ratings