Skip to content

Commit 77a588a

Browse files
committed
Fix handling of root value to be like Schema.execute.
1 parent 49a7b15 commit 77a588a

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

graphene/contrib/django/views.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,15 @@
22

33

44
class GraphQLView(BaseGraphQLView):
5+
graphene_schema = None
6+
57
def __init__(self, schema, **kwargs):
68
super(GraphQLView, self).__init__(
9+
graphene_schema=schema,
710
schema=schema.schema,
811
executor=schema.executor,
912
**kwargs
1013
)
14+
15+
def get_root_value(self, request):
16+
return self.graphene_schema.query(super(GraphQLView, self).get_root_value(request))

tests/contrib_django/test_urls.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ class Human(DjangoNode):
2323
class Meta:
2424
model = Article
2525

26-
@staticmethod
27-
def resolve_raises(*args):
26+
def resolve_raises(self, *args):
2827
raise Exception("This field should raise exception")
2928

3029
def get_node(self, id):

0 commit comments

Comments
 (0)