diff --git a/docs/queries.rst b/docs/queries.rst index 75bee3d..fe67a9d 100644 --- a/docs/queries.rst +++ b/docs/queries.rst @@ -153,6 +153,9 @@ automatically converted into enums: model = PetModel convert_choices_to_enum = ['kind'] +**Note:** Setting ``convert_choices_to_enum`` to an empty list is the same as +setting it to `False`. + Related models -------------- diff --git a/graphene_django/tests/test_types.py b/graphene_django/tests/test_types.py index f7c26a9..f7e41bf 100644 --- a/graphene_django/tests/test_types.py +++ b/graphene_django/tests/test_types.py @@ -303,3 +303,32 @@ class TestDjangoObjectType: } """ ) + + def test_django_objecttype_convert_choices_enum_empty_list(self, PetModel): + class Pet(DjangoObjectType): + class Meta: + model = PetModel + convert_choices_to_enum = [] + + class Query(ObjectType): + pet = Field(Pet) + + schema = Schema(query=Query) + + assert str(schema) == dedent( + """\ + schema { + query: Query + } + + type Pet { + id: ID! + kind: String! + cuteness: Int! + } + + type Query { + pet: Pet + } + """ + )