diff --git a/graphene_django/forms/converter.py b/graphene_django/forms/converter.py index 8916456..5d17680 100644 --- a/graphene_django/forms/converter.py +++ b/graphene_django/forms/converter.py @@ -63,6 +63,11 @@ def convert_form_field_to_list(field): return List(ID, required=field.required) +@convert_form_field.register(forms.MultipleChoiceField) +def convert_form_field_to_string_list(field): + return List(String, required=field.required) + + @convert_form_field.register(forms.DateField) def convert_form_field_to_date(field): return Date(description=field.help_text, required=field.required) diff --git a/graphene_django/forms/tests/test_converter.py b/graphene_django/forms/tests/test_converter.py index 955b952..ccf630f 100644 --- a/graphene_django/forms/tests/test_converter.py +++ b/graphene_django/forms/tests/test_converter.py @@ -101,7 +101,14 @@ def test_should_decimal_convert_float(): assert_conversion(forms.DecimalField, Float) -def test_should_multiple_choice_convert_connectionorlist(): +def test_should_multiple_choice_convert_list(): + field = forms.MultipleChoiceField() + graphene_type = convert_form_field(field) + assert isinstance(graphene_type, List) + assert graphene_type.of_type == String + + +def test_should_model_multiple_choice_convert_connectionorlist(): field = forms.ModelMultipleChoiceField(queryset=None) graphene_type = convert_form_field(field) assert isinstance(graphene_type, List)