From 3cf940d0c899be0c7703b3e85c2ed2097fe32ab9 Mon Sep 17 00:00:00 2001 From: Kuba Misiorny Date: Wed, 31 Mar 2021 19:31:20 +0200 Subject: [PATCH] Add ability to pass `execution_context_class` to `GraphQLView.as_view()` (#1109) * Add ability to pass `execution_context_class` to `GraphQLView.as_view()` Currently when passing `execution_context_class` like this: ``` GraphQLView.as_view(execution_context_class=CustomContext) ``` you get the following error from `View.as_view()` ``` TypeError: GraphQLView() received an invalid keyword 'execution_context_class'. as_view only accepts arguments that are already attributes of the class. ``` this PR fixes the `hasattr` check in `.as_view`. Fixes: #1072 * make black happy removed whitespace --- graphene_django/views.py | 1 + 1 file changed, 1 insertion(+) diff --git a/graphene_django/views.py b/graphene_django/views.py index 8341fc4..2e867a0 100644 --- a/graphene_django/views.py +++ b/graphene_django/views.py @@ -84,6 +84,7 @@ class GraphQLView(View): pretty = False batch = False subscription_path = None + execution_context_class = None def __init__( self,