Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

allow setting a custom Django Paginator in pagination.PageNumberPagin…#3631

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
lovelydinosaur merged 1 commit intoencode:masterfromsyphar:paginat
Nov 30, 2015

Conversation

@syphar
Copy link

…ation

@xordoquy
Copy link
Contributor

What's the motivation behind that change ? Why isn't the django validator enough ?

@syphar
Copy link
Author

@xordoquy in our codebase we are using a different Django Paginator for some bigger tables (where thecount(*) takes too much time, and an estimated page-count is enough.

This would help us setting our own paginator without having to copy/paste thepaginate_queryset method

@lovelydinosaur
Copy link
Contributor

Out of curiosity, what do you use for estimated page counts?
Also, is modifyingget_paginated_response an alternative here, or is that not sufficient?

Follow up... I guessnum_pages performs a count() - might be good if we could avoid that?

@syphar
Copy link
Author

we are using the postgres statistics for this table. it has currently around 3 Mio records, and the rough value is exact enough.

we already have modifiedget_paginated_response (similar to theHeader based example in the docs, which removes one call toPaginator.count.

Butpaginate_queryset callsPaginator.num_pages, which also callsPaginator.count.

(a count in these specific tables takes around 2-3 seconds)

@xordoquy
Copy link
Contributor

Sounds sensible to me.
Would probably rename thedjango_paginator_class to simplypaginator_class

@lovelydinosaur
Copy link
Contributor

django_paginator_class seems right - differentiate from our pagination controls.
I'm not 100% convinced if we want to add public API around this or not, but on balance I guess probably okay as-is.

@lovelydinosaur
Copy link
Contributor

But paginate_queryset calls Paginator.num_pages, which also calls Paginator.count.

Indeed. Making this easier to eliminate might be a good plan

@lovelydinosaur
Copy link
Contributor

Milestoning to push this to the top for a final review.

lovelydinosaur added a commit that referenced this pull requestNov 30, 2015
allow setting a custom Django Paginator class
@lovelydinosaurlovelydinosaur merged commit832d632 intoencode:masterNov 30, 2015
@lovelydinosaur
Copy link
Contributor

Thanks@syphar!

@sypharsyphar deleted the paginat branchDecember 1, 2015 06:40
@syphar
Copy link
Author

thanks@tomchristie and@xordoquy :)

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Projects

None yet

Milestone

3.3.2 Release

Development

Successfully merging this pull request may close these issues.

3 participants

@syphar@xordoquy@lovelydinosaur

[8]ページ先頭

©2009-2025 Movatter.jp