Store the current request in CursorPagination #8761
Replies: 1 comment 1 reply
-
Sure. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Background: Both
PageNumberPagination
andLimitOffsetPagination
store the current request inside of thepaginate_queryset
method (here and here respectively) into theself.request
variable.CursorPagination
doesn't do this.Proposal: I suggest a change to store the current request into the
self.request
variable also forCursorPagination
; I'm happy to open a pull request if the proposal is accepted.Rationale: Having access to
self.request
inside of the pagination classes is useful as it makes the classes easier to extend: when overriding methods we (for example) can access all the query parameters, etc. Additionally, making the access toself.request
consistent across all three built-in pagination types makes it easier to swap around the classes while keeping any custom overridden code the same.Beta Was this translation helpful? Give feedback.
All reactions