Skip to content

Pagination

Default pagination

An interface for limit/offset pagination can be use for basic pagination needs:

types.py
1
2
3
@strawberry_django.type(models.Fruit, pagination=True)
class Fruit:
    name: auto
schema.graphql
1
2
3
4
5
6
query {
  fruits(pagination: { offset: 0, limit: 2 }) {
    name
    color
  }
}

There is not default limit defined. All elements are returned if no pagination limit is defined.

Relay pagination

For more complex scenarios, a cursor pagination would be better. For this, use the relay integration to define those.