Created
August 25, 2020 06:03
-
-
Save velotiotech/1edb71826b4e1310a98746b7fb0acb1b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DynamicPaginationMixin(object): | |
""" | |
Controls pagination enable disable option using query param "pagination". | |
If pagination=false is passed in query params, data is returned without pagination | |
""" | |
def paginate_queryset(self, queryset): | |
pagination = self.request.query_params.get("pagination", "true") | |
if bool(pagination): | |
return None | |
return super().paginate_queryset(queryset) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment