From f6f04a027f5e7d9db61e435682647730db4578d6 Mon Sep 17 00:00:00 2001 From: Tormod Haugland Date: Thu, 26 Oct 2023 06:55:59 +0200 Subject: [PATCH] Fix some regressions from commit 38c9dd Move the non-None handling for patch and filter update mutations slightly, to conform to existing logic. Regressions should be removed, while we still are handling required and optional fields more gracefully. Signed-off-by: Tormod Haugland --- graphene_django_cud/mutations/batch_patch.py | 8 ++++---- graphene_django_cud/mutations/filter_update.py | 2 +- graphene_django_cud/mutations/patch.py | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/graphene_django_cud/mutations/batch_patch.py b/graphene_django_cud/mutations/batch_patch.py index 4ee6e87..f620f32 100644 --- a/graphene_django_cud/mutations/batch_patch.py +++ b/graphene_django_cud/mutations/batch_patch.py @@ -17,8 +17,8 @@ def __init_subclass_with_meta__( cls, _meta=None, model=None, - optional_fields=(), - required_fields=(), + optional_fields=None, + required_fields=None, type_name=None, **kwargs, ): @@ -35,8 +35,8 @@ def __init_subclass_with_meta__( return super().__init_subclass_with_meta__( _meta=_meta, model=model, - optional_fields=optional_fields, - required_fields=required_fields, + optional_fields=optional_fields or (), + required_fields=required_fields or (), type_name=input_type_name, **kwargs, ) diff --git a/graphene_django_cud/mutations/filter_update.py b/graphene_django_cud/mutations/filter_update.py index 2d7e444..f5326ac 100644 --- a/graphene_django_cud/mutations/filter_update.py +++ b/graphene_django_cud/mutations/filter_update.py @@ -45,7 +45,7 @@ def __init_subclass_with_meta__( only_fields=(), # Deprecated in favor of `fields` exclude=(), exclude_fields=(), # Deprecated in favor of `exclude` - optional_fields=(), + optional_fields=None, # Explicitly defaulted to None here and handled below. required_fields=(), field_types=None, auto_context_fields=None, diff --git a/graphene_django_cud/mutations/patch.py b/graphene_django_cud/mutations/patch.py index 77697b3..a51db20 100644 --- a/graphene_django_cud/mutations/patch.py +++ b/graphene_django_cud/mutations/patch.py @@ -17,8 +17,8 @@ def __init_subclass_with_meta__( cls, _meta=None, model=None, - optional_fields=(), - required_fields=(), + optional_fields=None, + required_fields=None, type_name=None, **kwargs, ): @@ -35,8 +35,8 @@ def __init_subclass_with_meta__( return super().__init_subclass_with_meta__( _meta=_meta, model=model, - optional_fields=optional_fields, - required_fields=required_fields, + optional_fields=optional_fields or (), + required_fields=required_fields or (), type_name=input_type_name, **kwargs, )