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

Apply LimitOffsetPagination in GET Infraction with default Page Size 100 #443

Merged
merged 13 commits into from
Apr 24, 2021

Conversation

kunal097
Copy link
Contributor

Add Default Pagination class LimitOffsetPagination with Page Size 100 in GET Infraction

@HassanAbouelela HassanAbouelela linked an issue Jan 26, 2021 that may be closed by this pull request
Copy link
Contributor

@Akarys42 Akarys42 left a comment

Choose a reason for hiding this comment

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

Hello, thank you for your contribution! There are a couple of things that needs to be reverted.

pydis_site/settings.py Outdated Show resolved Hide resolved
pydis_site/apps/api/viewsets/bot/infraction.py Outdated Show resolved Hide resolved
pydis_site/apps/api/viewsets/bot/infraction.py Outdated Show resolved Hide resolved
@coveralls
Copy link

coveralls commented Jan 27, 2021

Coverage Status

Coverage remained the same at 100.0% when pulling 657ef93 on kunal097:limit-infraction-result into fa4ea9d on python-discord:main.

Copy link
Contributor Author

@kunal097 kunal097 left a comment

Choose a reason for hiding this comment

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

Changes have been done as discussed. Please review the changes.

pydis_site/apps/api/viewsets/bot/pagination.py Outdated Show resolved Hide resolved
pydis_site/apps/api/viewsets/bot/pagination.py Outdated Show resolved Hide resolved
pydis_site/apps/api/viewsets/bot/pagination.py Outdated Show resolved Hide resolved
pydis_site/apps/api/viewsets/bot/pagination.py Outdated Show resolved Hide resolved
pydis_site/apps/api/viewsets/bot/infraction.py Outdated Show resolved Hide resolved
pydis_site/apps/api/viewsets/bot/pagination.py Outdated Show resolved Hide resolved
pydis_site/apps/api/viewsets/bot/infraction.py Outdated Show resolved Hide resolved
Copy link
Member

@MarkKoz MarkKoz left a comment

Choose a reason for hiding this comment

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

This works fine and I will approve it. However, I've left some more minor suggestions to clean up the documentation and make it more consistent.

pydis_site/apps/api/pagination.py Outdated Show resolved Hide resolved
pydis_site/apps/api/viewsets/bot/infraction.py Outdated Show resolved Hide resolved
pydis_site/apps/api/viewsets/bot/infraction.py Outdated Show resolved Hide resolved
pydis_site/apps/api/pagination.py Show resolved Hide resolved
pydis_site/apps/api/pagination.py Outdated Show resolved Hide resolved
Comment on lines 14 to 41
{
"count": 1,
"next": null,
"previous": null,
"results": [{
"id": 6,
"inserted_at": "2021-01-26T21:13:35.477879Z",
"expires_at": null,
"active": false,
"user": 1,
"actor": 2,
"type": "warning",
"reason": null,
"hidden": false
}]
}
## Required response
[{
"id": 6,
"inserted_at": "2021-01-26T21:13:35.477879Z",
"expires_at": null,
"active": false,
"user": 1,
"actor": 2,
"type": "warning",
"reason": null,
"hidden": false
}]
Copy link
Member

Choose a reason for hiding this comment

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

For consistency, ideally these would be formatted like the docs for viewsets. They are formatted as if they were copied from a Python REPL. They are also not indented consistently.

pydis_site/apps/api/pagination.py Show resolved Hide resolved
kunal097 and others added 5 commits March 7, 2021 20:29
Co-authored-by: Mark <kozlovmark@gmail.com>
Co-authored-by: Mark <kozlovmark@gmail.com>
Co-authored-by: Mark <kozlovmark@gmail.com>
Co-authored-by: Mark <kozlovmark@gmail.com>
Co-authored-by: Mark <kozlovmark@gmail.com>
Base automatically changed from master to main March 13, 2021 19:57
Copy link
Contributor

@Akarys42 Akarys42 left a comment

Choose a reason for hiding this comment

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

Thanks a lot for the PR, this works very nicely!

@Akarys42 Akarys42 enabled auto-merge April 24, 2021 14:45
Copy link
Contributor

@Akarys42 Akarys42 left a comment

Choose a reason for hiding this comment

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

Refresh

Copy link
Contributor

@Qwerty-133 Qwerty-133 left a comment

Choose a reason for hiding this comment

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

Approving in place of @Akarys42

@Akarys42 Akarys42 merged commit 478dfb2 into python-discord:main Apr 24, 2021
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.

Limit results when querying infractions
6 participants