Skip to content

Commit cc665df

Browse files
committed
Make view async for django.
1 parent c2d601c commit cc665df

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

graphene_django/views.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from django.http.response import HttpResponseBadRequest
1010
from django.shortcuts import render
1111
from django.utils.decorators import classonlymethod, method_decorator
12+
from django.utils.functional import classproperty
1213
from django.views.decorators.csrf import ensure_csrf_cookie
1314
from django.views.generic import View
1415
from graphql import (
@@ -497,6 +498,10 @@ def as_view(cls, **initkwargs):
497498
view._is_coroutine = coroutines._is_coroutine
498499
return view
499500

501+
@classproperty
502+
def view_is_async(cls):
503+
return True
504+
500505
async def dispatch(self, request, *args, **kwargs):
501506
try:
502507
if request.method.lower() not in ("get", "post"):

0 commit comments

Comments
 (0)