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
This commit is contained in:
Kuba Misiorny 2021-03-31 19:31:20 +02:00 committed by GitHub
parent 3058118e8f
commit 3cf940d0c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -84,6 +84,7 @@ class GraphQLView(View):
pretty = False
batch = False
subscription_path = None
execution_context_class = None
def __init__(
self,