Fix handling of root value to be like Schema.execute.

This commit is contained in:
Jake 2015-11-13 17:00:04 -05:00
parent 49a7b15a47
commit 77a588a5b1
2 changed files with 7 additions and 2 deletions

View File

@ -2,9 +2,15 @@ from graphql_django_view import GraphQLView as BaseGraphQLView
class GraphQLView(BaseGraphQLView):
graphene_schema = None
def __init__(self, schema, **kwargs):
super(GraphQLView, self).__init__(
graphene_schema=schema,
schema=schema.schema,
executor=schema.executor,
**kwargs
)
def get_root_value(self, request):
return self.graphene_schema.query(super(GraphQLView, self).get_root_value(request))

View File

@ -23,8 +23,7 @@ class Human(DjangoNode):
class Meta:
model = Article
@staticmethod
def resolve_raises(*args):
def resolve_raises(self, *args):
raise Exception("This field should raise exception")
def get_node(self, id):