Skip to content

Commit

Permalink
added convert_choices_to_enum optional argument
Browse files Browse the repository at this point in the history
  • Loading branch information
kurayami07734 committed Apr 11, 2024
1 parent ea45de0 commit f90f485
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions graphene_django/rest_framework/serializer_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand All @@ -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(
Expand Down

0 comments on commit f90f485

Please sign in to comment.