diff --git a/AUTHORS b/AUTHORS index bc8d6dee..419f2e90 100644 --- a/AUTHORS +++ b/AUTHORS @@ -4,4 +4,4 @@ Greg Aker Jerel Unruh Matt Layman Oliver Sauder - +Yaniv Peer diff --git a/example/tests/unit/test_pagination.py b/example/tests/unit/test_pagination.py index b0a08a94..e15bee4a 100644 --- a/example/tests/unit/test_pagination.py +++ b/example/tests/unit/test_pagination.py @@ -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 diff --git a/rest_framework_json_api/pagination.py b/rest_framework_json_api/pagination.py index d13b6ec4..523b14ec 100644 --- a/rest_framework_json_api/pagination.py +++ b/rest_framework_json_api/pagination.py @@ -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)