-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
Re-add ability to customize paginator class #3684
Labels
Milestone
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
As part of the 3.1 release DRF lost the ability to override the paginator class and replaced it with a custom implementation that uses Django's default paginator in the critical
paginate_queryset
method. This change severely limits the architectural separation of data pagination from view level pagination behavior.E.g. code that happens when the pagination page queryset is evaluated now needs to be handled in an overridden
Pagination.paginate_queryset
method. Since the instantiation of the paginator is in the middle of the defaultPageNumberPagination.paginate_queryset
method working around this deprecation results in effectively completely rewriting it and making it a future tech debt concern. The alternative to run queryset evaluation time code inpaginate_queryset
and then call the parentpaginate_queryset
is equally not satisfactory as at that point the page object hasn't been created yet which contains vital information that is not available on the pagination instance. Fetching that data after the fact would again require evaluation the queryset, again not wanted.As such the removal of the ability to override the paginator class is a step backwards that leads to brittle workarounds (monkeypatches) and removed the ability to hook into a key moment of pagination. Please advise what I can do to improve this.
The text was updated successfully, but these errors were encountered: