Skip to content

Assertion error with OffsetLimit Pagination #2920

Closed
@chescales

Description

@chescales

To reproduce this bug place a default pagination limit of, for instance, 50. This with the LimitOffset pagination. Then, in the browsable API for instance, let's say we have 17 objects of a specific collection. This bug happens when you put a different "limit" value than the default, and an "offset" higher than the amount of items.

In summary, for a default of 50 items per page, and 17 items in the collection returned:

https://url_to_list_endpoint/?limit=2&offset=18 (triggers AssertionError)
https://url_to_list_endpoint/?limit=2&offset=50 (triggers AssertionError)
https://url_to_list_endpoint/?offset=50 (does not trigger AssertionError)

Exception Location: .../venv/lib/python2.7/site-packages/rest_framework/pagination.py in _get_displayed_page_numbers, line 74

Thanks for the hard work!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions