From 30fa86084e9d1819f58be4416b3f022fa460014b Mon Sep 17 00:00:00 2001 From: Kuba Misiorny Date: Wed, 3 Feb 2021 12:20:49 +0100 Subject: [PATCH] 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 --- graphene_django/views.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/graphene_django/views.py b/graphene_django/views.py index 8341fc4d8..0185bbf9c 100644 --- a/graphene_django/views.py +++ b/graphene_django/views.py @@ -84,7 +84,8 @@ class GraphQLView(View): pretty = False batch = False subscription_path = None - + execution_context_class = None + def __init__( self, schema=None,