Skip to content

The REST API paginator should raise an exception if attempting to paginate an unordered queryset #18900

@jeremystretch

Description

@jeremystretch

Proposed Changes

Our OptionalLimitOffsetPagination pagination class should raise an exception whenever pagination is attempted on a queryset with no ordering applied.

Justification

This change was prompted by bug #18729. A queryset with no ordering applied (e.g. because of an applied annotation) is nondeterministic. Paginating through such a queryset is unreliable; an object can appear on multiple pages. Raising an exception exposes this dangerous condition.

Metadata

Metadata

Assignees

Labels

severity: lowDoes not significantly disrupt application functionality, or a workaround is availablestatus: acceptedThis issue has been accepted for implementationtype: bugA confirmed report of unexpected behavior in the application

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions