diff --git a/graphene_django/converter.py b/graphene_django/converter.py index c40313d..fbaf2e8 100644 --- a/graphene_django/converter.py +++ b/graphene_django/converter.py @@ -24,6 +24,7 @@ from graphql import assert_valid_name from .compat import ArrayField, HStoreField, JSONField, RangeField from .fields import DjangoListField, DjangoConnectionField from .utils import import_single_dispatch +from .settings import graphene_settings singledispatch = import_single_dispatch() @@ -58,7 +59,7 @@ def convert_django_field_with_choices(field, registry=None): if converted: return converted choices = getattr(field, "choices", None) - if choices: + if choices and graphene_settings.GRAPHENE_CONVERT_CHOICES_TO_ENUMS: meta = field.model._meta name = to_camel_case("{}_{}".format(meta.object_name, field.name)) choices = list(get_choices(choices)) diff --git a/graphene_django/settings.py b/graphene_django/settings.py index 7cd750a..23fdcb0 100644 --- a/graphene_django/settings.py +++ b/graphene_django/settings.py @@ -35,6 +35,7 @@ DEFAULTS = { "RELAY_CONNECTION_ENFORCE_FIRST_OR_LAST": False, # Max items returned in ConnectionFields / FilterConnectionFields "RELAY_CONNECTION_MAX_LIMIT": 100, + "GRAPHENE_CONVERT_CHOICES_TO_ENUMS": True, } if settings.DEBUG: