diff --git a/graphene_django/filter/fields.py b/graphene_django/filter/fields.py index 7d8d2d8..244fb39 100644 --- a/graphene_django/filter/fields.py +++ b/graphene_django/filter/fields.py @@ -66,7 +66,7 @@ class DjangoFilterConnectionField(DjangoConnectionField): kwargs = {} for k, v in args.items(): if k in filtering_args: - if k == "order_by": + if k == "order_by" and v is not None: v = to_snake_case(v) kwargs[k] = v return kwargs diff --git a/graphene_django/filter/tests/test_fields.py b/graphene_django/filter/tests/test_fields.py index fa8060b..9c94f06 100644 --- a/graphene_django/filter/tests/test_fields.py +++ b/graphene_django/filter/tests/test_fields.py @@ -1224,7 +1224,7 @@ def test_filter_filterset_based_on_mixin(): } } - result = schema.execute(query, variable_values={"email": reporter_1.email}) + result = schema.execute(query, variable_values={"email": reporter_1.email},) assert not result.errors assert result.data == expected diff --git a/graphene_django/views.py b/graphene_django/views.py index 3123118..8341fc4 100644 --- a/graphene_django/views.py +++ b/graphene_django/views.py @@ -94,6 +94,7 @@ class GraphQLView(View): pretty=False, batch=False, subscription_path=None, + execution_context_class=None, ): if not schema: schema = graphene_settings.SCHEMA @@ -111,6 +112,7 @@ class GraphQLView(View): self.pretty = self.pretty or pretty self.graphiql = self.graphiql or graphiql self.batch = self.batch or batch + self.execution_context_class = execution_context_class if subscription_path is None: self.subscription_path = graphene_settings.SUBSCRIPTION_PATH @@ -307,10 +309,8 @@ class GraphQLView(View): try: extra_options = {} - if getattr(self, "executor", None): - # We only include it optionally since - # executor is not a valid argument in all backends - extra_options["executor"] = self.executor + if self.execution_context_class: + extra_options["execution_context_class"] = self.execution_context_class options = { "source": query,