You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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) + 1
and when count is zero too (it means there is no object in our data, model etc.),
For 3.2.2
https://github.com/tomchristie/django-rest-framework/blob/1b53e804ee86e5611bb02ced499e1fcc08b6c5f9/rest_framework/pagination.py#L414
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)
and when count is zero too (it means there is no object in our data, model etc.),
final computed as 0 (zero) because 'self.count - self.offset = self.offset = 0'
And finally,
current = 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
Am I doing wrong anything or is it just a bug?
The text was updated successfully, but these errors were encountered: