mirror of
https://github.com/graphql-python/graphene-django.git
synced 2024-11-28 04:23:44 +03:00
Add syntax coloration
parent
8af66e5680
commit
2511ba50bb
|
@ -4,7 +4,7 @@ For this example, we're going to assume a basic understanding of how [Relay pagi
|
|||
|
||||
In a nutshell, `pagination` is implemented via graphene relay's `Connection` and `ConnectionField` pairing. With these in place, you'll see `pageInfo` available within your queries. It looks something like this:
|
||||
|
||||
```
|
||||
```json
|
||||
"pageInfo": {
|
||||
"startCursor": "YXJyYXljb25uZWN0aW9uOjQx",
|
||||
"endCursor": "YXJyYXljb25uZWN0aW9uOjQz",
|
||||
|
@ -14,18 +14,18 @@ In a nutshell, `pagination` is implemented via graphene relay's `Connection` and
|
|||
```
|
||||
|
||||
In addition to a `cursor` element within `edges` that will show you the cursor id for each element, like so:
|
||||
```
|
||||
edges {
|
||||
```graphql
|
||||
edges {
|
||||
cursor
|
||||
node {
|
||||
<whatever>
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
The basic schema below provides relay cursor-based pagination, combined with graphene_django filter capability.
|
||||
|
||||
```
|
||||
```py
|
||||
from graphene import relay
|
||||
from graphene_django.types import DjangoObjectType
|
||||
from graphene_django.filter import DjangoFilterConnectionField
|
||||
|
@ -44,7 +44,7 @@ class Query(object):
|
|||
```
|
||||
|
||||
The following query, (the pageInfo element is included for illustration, but isn't necessary for the query to resolve):
|
||||
```
|
||||
```graphql
|
||||
{
|
||||
places(first: 3, after: "YXJyYXljb25uZWN0aW9uOjQx") {
|
||||
pageInfo {
|
||||
|
@ -65,7 +65,7 @@ The following query, (the pageInfo element is included for illustration, but isn
|
|||
```
|
||||
|
||||
Gives us:
|
||||
```
|
||||
```json
|
||||
{
|
||||
"data": {
|
||||
"places": {
|
||||
|
|
Loading…
Reference in New Issue
Block a user