Skip to content

Configurable offset cutoff with CursorPagination #4053

@rowanseymour

Description

@rowanseymour

Picking up where the #3143 ended.. in our API implementation we generally order by a combination of a millisecond accuracy timestamp and pk, e.g.

class ModifiedOnCursorPagination(CursorPagination):
    ordering = ('-modified_on', '-pk')

It's possible sometimes for large numbers of items to end up with the same timestamp so we've been overriding decode_cursor so that we can increase OFFSET_CUTOFF (malicious queries are less of a concern in this case). Seems like that value could be configurable though, so happy to make a simple PR if there's a consensus on whether it should be a class variable or settings value.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions