Implement CursorPagination without OrderingFilter #8144

Closed
opened 2025-12-29 20:33:04 +01:00 by adam · 0 comments
Owner

Originally created by @GCHQDeveloper926 on GitHub (May 31, 2023).

Ref PR #10764, I've managed to get cursor pagination working by providing a default OrderingFilter, which gets round the previous exception of assertionerror: using cursor pagination, but filter class orderingfilter returned a none ordering.

Looking at the docs for Django and what they advise for CursorPagination I'm not entirely sure whether you would want to use ordering and cursorPagination together, it feels like it would be more useful in a scenario where you want cursor efficiency but don't care about the ordering (bulk updates, deletes, exports etc).

Would people be happy with me reopening https://github.com/netbox-community/netbox/pull/9716 / #9599 on a new PR and providing an implementing that doesn't use ordering but just uses a default of "created" as the field?

TL:DR @jeremystretch originally closed because they didn't have time to track down the bug - my suggestion is to hard code the filter following the Django docs guidance.

          Seems like there's a conflict using CursorPagination with OrderingFilter. Unfortunately I don't have time to track it down, so I'm going to close this.

Originally posted by @jeremystretch in https://github.com/netbox-community/netbox/issues/10764#issuecomment-1300299474

Originally created by @GCHQDeveloper926 on GitHub (May 31, 2023). Ref PR #10764, I've managed to get cursor pagination working by providing a default OrderingFilter, which gets round the previous exception of `assertionerror: using cursor pagination, but filter class orderingfilter returned a none ordering`. Looking at the [docs for Django](https://www.django-rest-framework.org/api-guide/pagination/#details-and-limitations) and what they advise for CursorPagination I'm not entirely sure whether you would want to use ordering and cursorPagination together, it feels like it would be more useful in a scenario where you want cursor efficiency but don't care about the ordering (bulk updates, deletes, exports etc). Would people be happy with me reopening https://github.com/netbox-community/netbox/pull/9716 / #9599 on a new PR and providing an implementing that doesn't use ordering but just uses a default of "created" as the field? TL:DR @jeremystretch originally closed because they didn't have time to track down the bug - my suggestion is to hard code the filter following the Django docs guidance. Seems like there's a conflict using CursorPagination with OrderingFilter. Unfortunately I don't have time to track it down, so I'm going to close this. _Originally posted by @jeremystretch in https://github.com/netbox-community/netbox/issues/10764#issuecomment-1300299474_
adam closed this issue 2025-12-29 20:33:04 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#8144