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

Django: fixes pagination parameter #128

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

cawal
Copy link
Contributor

@cawal cawal commented Aug 9, 2021

When a user pass the p parameter in query,
Django returns a string. The string needs to be
casted to integer in order to be used in the paginator.
Otherwise, the response returns BadRequest.

@HRezaei
Copy link

HRezaei commented Oct 22, 2021

Good job @cawal!
I need this bug fix. 😊
@toastdriven and other contributors: would you please accept this PR?

restless/dj.py Outdated
@@ -28,7 +28,7 @@ def serialize_list(self, data):
page_size = getattr(self, 'page_size', getattr(settings, 'RESTLESS_PAGE_SIZE', 10))
paginator = Paginator(data, page_size)

page_number = self.request.GET.get('p', 1)
page_number = int(self.request.GET.get('p', 1))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also need to treat the error in case the cast is not possible.

@seocam
Copy link
Collaborator

seocam commented Dec 23, 2021

We need to rebase and to get tests running. I'm not sure why the tests are not running.

When a user pass the `p` parameter in query,
Django returns a string. The string needs to be
casted to integer in order to be used in the paginator.
Otherwise, the response returns BadRequest.
@cawal
Copy link
Contributor Author

cawal commented Dec 24, 2021

Rebased. =]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants