I have a tastypie api that I'm working on and in the list views for my api resources I'd like to get the entire list of data without pagination applied, regardless of the number of objects in the list. I don't need a custom paginator with a high limit, I'd like to disable pagination entirely.
I could potentially modify my client to deal with the pagination (the api is being accessed from a C++ DLL rather than a web browser so it's a little more complicated but possible) but if I can disable it that would be easier.
Is there a switch to disable the paginator for different resources, or possibly an api wide switch to disable pagination on all resources registered to that api object?
To do this you need to set at least two different things.
In the site settings file, set
API_LIMIT_PER_PAGE = 0
In the resource Meta class that you want to disable pagination for, set:
class MyResource(ModelResource):
...
class Meta:
...
max_limit = None
Then if you navigate to the list view of the resource, the returned content should show a limit of 0.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With