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

provide a default_per_page setting #1362

Open
wolvever opened this issue Jul 23, 2024 · 1 comment
Open

provide a default_per_page setting #1362

wolvever opened this issue Jul 23, 2024 · 1 comment

Comments

@wolvever
Copy link

In this code https://github.com/pallets-eco/flask-sqlalchemy/blob/main/src/flask_sqlalchemy/pagination.py#L132

When per_page = 0, it will be set to 20 if error_out = False.

        if per_page < 1:
            if error_out:
                abort(404)
            else:
                per_page = 20

20 might not be the case for all scenarioes, better give it a configurable value.

@davidism davidism changed the title Limit = 0 provides a configurable per_page provide a default_per_page setting Aug 23, 2024
@davidism
Copy link
Member

davidism commented Aug 23, 2024

Adding a default_per_page=20 argument to Pagination.__init__ as well as the corresponding methods makes sense. There are some other spots besides the one you linked that use that default value as well.

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

No branches or pull requests

2 participants