Improved django execute view

This commit is contained in:
Syrus Akbary 2015-10-14 11:33:20 -07:00
parent b4b7783ed1
commit 979dd0f498

View File

@ -30,12 +30,12 @@ class GraphQLView(View):
} for e in errors]
return HttpResponse(json.dumps({'errors': errors}), content_type='application/json')
def execute_query(self, request, query):
def execute_query(self, request, query, *args, **kwargs):
if not query:
return self.response_errors(Exception("Must provide query string."))
else:
try:
result = self.schema.execute(query, root=object())
result = self.schema.execute(query, *args, **kwargs)
data = self.format_result(result)
except Exception as e:
if settings.DEBUG: