-
Notifications
You must be signed in to change notification settings - Fork 299
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix pagination next and previous links for schedules and integrations GET endpoints #2467
fix pagination next and previous links for schedules and integrations GET endpoints #2467
Conversation
for schedules and integrations GET endpoints
@@ -219,7 +219,7 @@ def test_get_list_schedules_pagination( | |||
client = APIClient() | |||
|
|||
schedule_list_url = reverse("api-internal:schedule-list") | |||
absolute_url = create_engine_url(schedule_list_url, override_base="http://testserver") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be fine. override_base
has no effect here because the actual absolute URL that is being generated is overriden here on the actual request
object itself in PathPrefixedCursorPagination.paginate_queryset
:
class PathPrefixedPagination(PageNumberPagination):
def paginate_queryset(self, queryset, request, view=None):
request.build_absolute_uri = lambda: create_engine_url(request.get_full_path())
return super().paginate_queryset(queryset, request, view)
def paginate_queryset(self, queryset, request, view=None): | ||
"""Override to apply pagination only if ?page= is present in query params | ||
Required for backwards compatibility with older versions | ||
""" | ||
page_number = request.query_params.get(self.page_query_param, None) | ||
if not page_number: | ||
return None | ||
return super().paginate_queryset(queryset, request, view) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this can be removed. @iskhakov wdyt?
This was likely here to handle the transition when the paginated integration's page was release, and to handle the case in Cloud where UI clients running the previous version would've received a different API response.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree
Which issue(s) this PR fixes
closes #2463
Checklist
pr:no public docs
PR label added if not required)CHANGELOG.md
updated (orpr:no changelog
PR label added if not required)