Coder Social home page Coder Social logo

Comments (5)

uriyyo avatar uriyyo commented on June 2, 2024 1

You can do it by passing size parameter in case of Page or limit parameter in case of LimitOffsetPage.

For instance:

@app.get('/users', response_model=Page[User])
async def get_users():
    return paginate(users)
curl http://localhost:8000/users?size=100

from fastapi-pagination.

uriyyo avatar uriyyo commented on June 2, 2024

@zdytch Could you please provide use-case when it will be useful?

from fastapi-pagination.

zdytch avatar zdytch commented on June 2, 2024

@uriyyo
Setting page size on client side is a common practice. Just a couple of screenshots from google images:
https://jochen.kirstaetter.name/content/images/2019/01/telerik_radgrid_custom_pagesize.png
https://user-images.githubusercontent.com/34887212/80689034-067cea80-8acd-11ea-8c8d-48cca138779c.png

For example, DRF allows client to send page_size as a query param:
https://www.django-rest-framework.org/api-guide/pagination/

However, I'm not sure, if paginate() function is the best place to set this parameter. Maybe better approach exists.

from fastapi-pagination.

zdytch avatar zdytch commented on June 2, 2024

@uriyyo
Hah, sorry for silly question!

from fastapi-pagination.

uriyyo avatar uriyyo commented on June 2, 2024

No worries)

from fastapi-pagination.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.