Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ExtraGraphQLView #195

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions graphene_django_extras/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
from django.core.cache import caches
from django.views.decorators.csrf import csrf_exempt
from graphene_django.views import GraphQLView
from graphql import Source, parse, execute
from graphql.execution.executor import subscribe
from graphql.utils.get_operation_ast import get_operation_ast
from graphql import Source, parse, execute, OperationType
from graphql.execution import subscribe
from graphql.utilities.get_operation_ast import get_operation_ast
from rest_framework.decorators import (
authentication_classes,
permission_classes,
Expand Down Expand Up @@ -58,7 +58,7 @@ def dispatch(self, request, *args, **kwargs):

cache = caches["default"]
operation_ast = self.get_operation_ast(request)
if operation_ast and operation_ast.operation == "mutation":
if operation_ast and operation_ast.operation == OperationType.MUTATION:
cache.clear()
return self.super_call(request, *args, **kwargs)

Expand Down Expand Up @@ -109,7 +109,7 @@ def get_response(self, request, data, show_graphiql=False):
self.format_error(e) for e in execution_result.errors
]

if execution_result.invalid:
if getattr(execution_result, 'invalid', False):
status_code = 400
else:
response["data"] = execution_result.data
Expand Down
101 changes: 28 additions & 73 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ django-filter = "^22.1"
djangorestframework = "^3"
python-dateutil = "^2.8.0"
graphene-django = "^3.0"
Rx = "^3.2.0"

[tool.poetry.dev-dependencies]
pytest = "^6.2"
Expand Down