Skip to content
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

audoma_action should support pagination #49

Open
mtyton opened this issue Aug 25, 2023 · 0 comments
Open

audoma_action should support pagination #49

mtyton opened this issue Aug 25, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@mtyton
Copy link
Collaborator

mtyton commented Aug 25, 2023

Currently to support pagination you have to add pagination fields to result serializer.
Example:

@audoma_action(
    methods=['GET'], detail=False,
    results={200: SomeSerializer},
    results_many=True,
)
def get(self, request, **kwargs):
    queryset = self.get_queryset()
    data = self.paginate_queryset(queryset)
    return {
        "results": data,
        "count": self.paginator.page.paginator.count,
        "next": self.paginator.page.has_next(),
        "previous": self.paginator.page.has_previous()
    }, 200

In this case serializer won't work if there are no pagination field specified on it.
audoma_action should accept some kind of parameter, which will allow it to handle pagination.

@mtyton mtyton added the enhancement New feature or request label Aug 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant