Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7k
Closed
Labels
Milestone
Description
For 3.2.2
In LimitOffsetPagination.get_html_context method, when offset value is zero, current is 1 (bacause _divide_with_ceil function always returns 0 when first param is 0)
current = _divide_with_ceil(self.offset, self.limit) + 1and when count is zero too (it means there is no object in our data, model etc.),
final = ( _divide_with_ceil(self.count - self.offset, self.limit) + _divide_with_ceil(self.offset, self.limit) )final computed as 0 (zero) because 'self.count - self.offset = self.offset = 0'
And finally,
if current > final: current = finalcurrent = final = 0 .
Then _get_displayed_page_numbers function raises assertion error on here:
https://github.com/tomchristie/django-rest-framework/blob/1b53e804ee86e5611bb02ced499e1fcc08b6c5f9/rest_framework/pagination.py#L75
assert current >= 1assert final >= currentAm I doing wrong anything or is it just a bug?