Skip to main content

Usage

Supposing in myapp.schema you have a pydantic BaseModel to represent your model

from fastapi import Depends
from tortoise_pagination import Pagination, Page

from myapp.main import app
from myapp.models import MyModel
from myapp.schema import MySchema


@app.get('/mymodel')
async def my_view(pagination: Depends(Pagination.from_query)) -> Page[MySchema]:
    return await pagination.paginated_response(MyModel.all(), MySchema)

now you can request with:

curl http://localhost:8000/mymodel?offset=0&limit=20

returned structure:

  • items list[MySchema]
  • count: NonNegativeInt -> the number of entries for this queryset (MyModel.all().count()) wich the frontend will need to be able to display a pagination

Release files for tortoise-pagination 1.3.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tortoise-pagination 1.3.2
File Size Uploaded
tortoise_pagination-1.3.2.tar.gz 2.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tortoise-pagination 1.3.2
File Interpreter ABI Platform
tortoise_pagination-1.3.2-py3-none-any.whl Python 3 none any Details

Total release size: 5.9 kB

Release files / tortoise_pagination-1.3.2.tar.gz

Download URL tortoise_pagination-1.3.2.tar.gz
Size 2.6 kB
Tags Source
SHA-256 checksum
How to use checksums
d6d3fa4cfcec7b0ea895a668cfb3a1dfdca19034d1f417661d92b1d5f13ed7ff
BLAKE2b-256 checksum
How to use checksums
3b74cd7d6e506286502d1c807252bfd018e7a22f4ff9f7859d50f4af22ae99ae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.0.1 CPython/3.13.3 Linux/6.14.2-arch1-1

Release files / tortoise_pagination-1.3.2-py3-none-any.whl

Download URL tortoise_pagination-1.3.2-py3-none-any.whl
Size 3.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fc2bd94e288c899eb705a281dfa6fab78863957c29f88b177b4371c47b244177
BLAKE2b-256 checksum
How to use checksums
d2d833a0b50c32782df1f6f2014aca648e3a67424c2261be2db2ce9525ce2ca4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.0.1 CPython/3.13.3 Linux/6.14.2-arch1-1

Release history Release notifications | RSS feed

This release

1.3.2 This release

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.2.13

2 release files

1.2.12

2 release files

1.2.9

2 release files

1.2.8

2 release files

1.2.7

2 release files

1.2.6

2 release files

1.2.5

2 release files

1.2.4

2 release files

1.2.3

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.6

2 release files

1.1.5

2 release files

1.1.4

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page