Skip to content

Add LimitOffsetPagination #205

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 15, 2016
Merged

Add LimitOffsetPagination #205

merged 3 commits into from
Feb 15, 2016

Conversation

lostb1t
Copy link

@lostb1t lostb1t commented Feb 12, 2016

While its not an official specification or requirement of the JSON API, DRF does provide support for limit/offset pagination and is widely used. So i think this might be an useful addition to this package, and can be used as optional paginator.

Limit and offset arguments are based on the pagination notes here: http://jsonapi.org/format/#fetching-pagination.

Examples:

http://api.example.org/accounts/?page[limit]=100
http://api.example.org/accounts/?page[offset]=400&page[limit]=100

I will write some unit test once one of the maintainers is oke with this going in.

@jerel
Copy link
Member

jerel commented Feb 12, 2016

@sarendsen nice work! I'd be happy to merge this in so that users have the option to enable it. We've been slowly switching to pytest style tests so this would be the proper place to add new tests: integration or unit

@jsenecal
Copy link
Member

hmmm, what's wrong with Travis ?

@jerel
Copy link
Member

jerel commented Feb 12, 2016

Dunno, it's passing now though so they must have had an outage.

@lostb1t
Copy link
Author

lostb1t commented Feb 15, 2016

Added a very basic unit test. The paginator has a lot of shared code with DRF. So DRF tests applies as well. If more needed let me know.

jerel added a commit that referenced this pull request Feb 15, 2016
@jerel jerel merged commit 697adf1 into django-json-api:develop Feb 15, 2016
@jerel
Copy link
Member

jerel commented Feb 15, 2016

@sarendsen thanks for the contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants