2016-09-18 02:29:00 +03:00
|
|
|
import graphene
|
|
|
|
from graphene import Schema, relay
|
|
|
|
|
2016-09-18 03:09:56 +03:00
|
|
|
from ..types import DjangoObjectType
|
2016-09-18 02:29:00 +03:00
|
|
|
from .models import Article, Reporter
|
|
|
|
|
|
|
|
|
|
|
|
class Character(DjangoObjectType):
|
|
|
|
class Meta:
|
|
|
|
model = Reporter
|
2018-07-20 02:51:33 +03:00
|
|
|
interfaces = (relay.Node,)
|
2020-06-11 13:09:52 +03:00
|
|
|
fields = "__all__"
|
2016-09-18 02:29:00 +03:00
|
|
|
|
2017-07-28 19:43:27 +03:00
|
|
|
def get_node(self, info, id):
|
2016-09-18 02:29:00 +03:00
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
class Human(DjangoObjectType):
|
|
|
|
raises = graphene.String()
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
model = Article
|
2018-07-20 02:51:33 +03:00
|
|
|
interfaces = (relay.Node,)
|
2020-06-11 13:09:52 +03:00
|
|
|
fields = "__all__"
|
2016-09-18 02:29:00 +03:00
|
|
|
|
2017-07-28 19:43:27 +03:00
|
|
|
def resolve_raises(self, info):
|
2016-09-18 02:29:00 +03:00
|
|
|
raise Exception("This field should raise exception")
|
|
|
|
|
2017-07-28 19:43:27 +03:00
|
|
|
def get_node(self, info, id):
|
2016-09-18 02:29:00 +03:00
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
class Query(graphene.ObjectType):
|
|
|
|
human = graphene.Field(Human)
|
|
|
|
|
2017-07-28 19:43:27 +03:00
|
|
|
def resolve_human(self, info):
|
2016-09-18 02:29:00 +03:00
|
|
|
return Human()
|
|
|
|
|
|
|
|
|
|
|
|
schema = Schema(query=Query)
|