From a94afcb317232e433a3e52f6ade95741e9dda74c Mon Sep 17 00:00:00 2001 From: Aditya Ghidora Date: Thu, 11 Apr 2024 13:46:18 +0530 Subject: [PATCH] added convert_choices_to_enum optional argument --- graphene_django/rest_framework/serializer_converter.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/graphene_django/rest_framework/serializer_converter.py b/graphene_django/rest_framework/serializer_converter.py index 51695c5d..cad773d0 100644 --- a/graphene_django/rest_framework/serializer_converter.py +++ b/graphene_django/rest_framework/serializer_converter.py @@ -64,7 +64,7 @@ def convert_serializer_field( return graphql_type(*args, **kwargs) -def convert_serializer_to_input_type(serializer_class): +def convert_serializer_to_input_type(serializer_class, convert_choices_to_enum=True): cached_type = convert_serializer_to_input_type.cache.get( serializer_class.__name__, None ) @@ -73,7 +73,9 @@ def convert_serializer_to_input_type(serializer_class): serializer = serializer_class() items = { - name: convert_serializer_field(field) + name: convert_serializer_field( + field, convert_choices_to_enum=convert_choices_to_enum + ) for name, field in serializer.fields.items() } ret_type = type(