Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix for pagination ‘last’ link to give the real last page #353

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
mblayman merged 3 commits into django-json-api:develop from yanivp:bugfix/fix_pagination_last_link
May 28, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion AUTHORS
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ Greg Aker <greg@gregaker.net>
Jerel Unruh <mail@unruhdesigns.com>
Matt Layman <http://www.mattlayman.com>
Oliver Sauder <os@esite.ch>

Yaniv Peer <yanivpeer@gmail.com>
2 changes: 1 addition & 1 deletion example/tests/unit/test_pagination.py
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def test_valid_offset_limit(self):
offset = 10
limit = 5
count = len(self.queryset)
last_offset = count - limit
last_offset = (count // limit) * limit
next_offset = 15
prev_offset = 5

Expand Down
2 changes: 1 addition & 1 deletion rest_framework_json_api/pagination.py
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def get_last_link(self):
url = self.request.build_absolute_uri()
url = replace_query_param(url, self.limit_query_param, self.limit)

offset = self.count - self.limit
offset = (self.count // self.limit) * self.limit

if offset <= 0:
return remove_query_param(url, self.offset_query_param)
Expand Down

AltStyle によって変換されたページ (->オリジナル) /