fix order_by snake casing by checking if value is None, switch executor to execution_context_class since schema.execute no longer supports executor

This commit is contained in:
Jason Kraus 2020-12-30 15:30:42 -08:00
parent ac8aaf8525
commit 81d167a290
3 changed files with 6 additions and 6 deletions

View File

@ -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

View File

@ -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

View File

@ -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,