mirror of
https://github.com/graphql-python/graphene-django.git
synced 2025-07-05 21:03:13 +03:00
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:
parent
ac8aaf8525
commit
81d167a290
|
@ -66,7 +66,7 @@ class DjangoFilterConnectionField(DjangoConnectionField):
|
||||||
kwargs = {}
|
kwargs = {}
|
||||||
for k, v in args.items():
|
for k, v in args.items():
|
||||||
if k in filtering_args:
|
if k in filtering_args:
|
||||||
if k == "order_by":
|
if k == "order_by" and v is not None:
|
||||||
v = to_snake_case(v)
|
v = to_snake_case(v)
|
||||||
kwargs[k] = v
|
kwargs[k] = v
|
||||||
return kwargs
|
return kwargs
|
||||||
|
|
|
@ -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 not result.errors
|
||||||
assert result.data == expected
|
assert result.data == expected
|
||||||
|
|
|
@ -94,6 +94,7 @@ class GraphQLView(View):
|
||||||
pretty=False,
|
pretty=False,
|
||||||
batch=False,
|
batch=False,
|
||||||
subscription_path=None,
|
subscription_path=None,
|
||||||
|
execution_context_class=None,
|
||||||
):
|
):
|
||||||
if not schema:
|
if not schema:
|
||||||
schema = graphene_settings.SCHEMA
|
schema = graphene_settings.SCHEMA
|
||||||
|
@ -111,6 +112,7 @@ class GraphQLView(View):
|
||||||
self.pretty = self.pretty or pretty
|
self.pretty = self.pretty or pretty
|
||||||
self.graphiql = self.graphiql or graphiql
|
self.graphiql = self.graphiql or graphiql
|
||||||
self.batch = self.batch or batch
|
self.batch = self.batch or batch
|
||||||
|
self.execution_context_class = execution_context_class
|
||||||
if subscription_path is None:
|
if subscription_path is None:
|
||||||
self.subscription_path = graphene_settings.SUBSCRIPTION_PATH
|
self.subscription_path = graphene_settings.SUBSCRIPTION_PATH
|
||||||
|
|
||||||
|
@ -307,10 +309,8 @@ class GraphQLView(View):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
extra_options = {}
|
extra_options = {}
|
||||||
if getattr(self, "executor", None):
|
if self.execution_context_class:
|
||||||
# We only include it optionally since
|
extra_options["execution_context_class"] = self.execution_context_class
|
||||||
# executor is not a valid argument in all backends
|
|
||||||
extra_options["executor"] = self.executor
|
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
"source": query,
|
"source": query,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user