You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
756 B

import graphene
from graphene import Schema, relay
from ..types import DjangoObjectType
from .models import Article, Reporter
class Character(DjangoObjectType):
class Meta:
model = Reporter
interfaces = (relay.Node, )
def get_node(self, id, context, info):
class Human(DjangoObjectType):
raises = graphene.String()
class Meta:
model = Article
interfaces = (relay.Node, )
def resolve_raises(self, *args):
raise Exception("This field should raise exception")
def get_node(self, id):
class Query(graphene.ObjectType):
human = graphene.Field(Human)
def resolve_human(self, args, context, info):
return Human()
schema = Schema(query=Query)