mirror of
https://github.com/graphql-python/graphene.git
synced 2025-04-25 12:03:41 +03:00
Fix handling of root value to be like Schema.execute
.
This commit is contained in:
parent
49a7b15a47
commit
77a588a5b1
|
@ -2,9 +2,15 @@ from graphql_django_view import GraphQLView as BaseGraphQLView
|
||||||
|
|
||||||
|
|
||||||
class GraphQLView(BaseGraphQLView):
|
class GraphQLView(BaseGraphQLView):
|
||||||
|
graphene_schema = None
|
||||||
|
|
||||||
def __init__(self, schema, **kwargs):
|
def __init__(self, schema, **kwargs):
|
||||||
super(GraphQLView, self).__init__(
|
super(GraphQLView, self).__init__(
|
||||||
|
graphene_schema=schema,
|
||||||
schema=schema.schema,
|
schema=schema.schema,
|
||||||
executor=schema.executor,
|
executor=schema.executor,
|
||||||
**kwargs
|
**kwargs
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def get_root_value(self, request):
|
||||||
|
return self.graphene_schema.query(super(GraphQLView, self).get_root_value(request))
|
||||||
|
|
|
@ -23,8 +23,7 @@ class Human(DjangoNode):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Article
|
model = Article
|
||||||
|
|
||||||
@staticmethod
|
def resolve_raises(self, *args):
|
||||||
def resolve_raises(*args):
|
|
||||||
raise Exception("This field should raise exception")
|
raise Exception("This field should raise exception")
|
||||||
|
|
||||||
def get_node(self, id):
|
def get_node(self, id):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user