Skip to content

Commit

Permalink
Add ability to pass execution_context_class to `GraphQLView.as_view…
Browse files Browse the repository at this point in the history
…()` (#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
  • Loading branch information
kubami committed Mar 31, 2021
1 parent 3058118 commit 3cf940d
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions graphene_django/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ class GraphQLView(View):
pretty = False
batch = False
subscription_path = None
execution_context_class = None

def __init__(
self,
Expand Down

0 comments on commit 3cf940d

Please sign in to comment.