mirror of
https://github.com/graphql-python/graphene-django.git
synced 2024-11-26 03:24:07 +03:00
Fixed starwars schema
This commit is contained in:
parent
5cba3f67fe
commit
4127031d2a
|
@ -1,6 +1,6 @@
|
||||||
import graphene
|
import graphene
|
||||||
from graphene import Schema, relay, resolve_only_args
|
from graphene import Schema, relay, resolve_only_args
|
||||||
from graphene_django import DjangoObjectType
|
from graphene_django import DjangoObjectType, DjangoConnectionField
|
||||||
|
|
||||||
from .data import (create_ship, get_empire, get_faction, get_rebels, get_ship,
|
from .data import (create_ship, get_empire, get_faction, get_rebels, get_ship,
|
||||||
get_ships)
|
get_ships)
|
||||||
|
@ -18,7 +18,6 @@ class Ship(DjangoObjectType):
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_node(cls, id, context, info):
|
def get_node(cls, id, context, info):
|
||||||
node = get_ship(id)
|
node = get_ship(id)
|
||||||
print(node)
|
|
||||||
return node
|
return node
|
||||||
|
|
||||||
|
|
||||||
|
@ -61,7 +60,7 @@ class Query(graphene.ObjectType):
|
||||||
rebels = graphene.Field(Faction)
|
rebels = graphene.Field(Faction)
|
||||||
empire = graphene.Field(Faction)
|
empire = graphene.Field(Faction)
|
||||||
node = relay.Node.Field()
|
node = relay.Node.Field()
|
||||||
ships = relay.ConnectionField(Ship, description='All the ships.')
|
ships = DjangoConnectionField(Ship, description='All the ships.')
|
||||||
|
|
||||||
@resolve_only_args
|
@resolve_only_args
|
||||||
def resolve_ships(self):
|
def resolve_ships(self):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user