mirror of
https://github.com/graphql-python/graphene-django.git
synced 2025-07-14 02:02:20 +03:00
add setting to disable enum conversion
This commit is contained in:
parent
f76f38ef30
commit
4f58783fb9
|
@ -24,6 +24,7 @@ from graphql import assert_valid_name
|
||||||
from .compat import ArrayField, HStoreField, JSONField, RangeField
|
from .compat import ArrayField, HStoreField, JSONField, RangeField
|
||||||
from .fields import DjangoListField, DjangoConnectionField
|
from .fields import DjangoListField, DjangoConnectionField
|
||||||
from .utils import import_single_dispatch
|
from .utils import import_single_dispatch
|
||||||
|
from .settings import graphene_settings
|
||||||
|
|
||||||
singledispatch = import_single_dispatch()
|
singledispatch = import_single_dispatch()
|
||||||
|
|
||||||
|
@ -58,7 +59,7 @@ def convert_django_field_with_choices(field, registry=None):
|
||||||
if converted:
|
if converted:
|
||||||
return converted
|
return converted
|
||||||
choices = getattr(field, "choices", None)
|
choices = getattr(field, "choices", None)
|
||||||
if choices:
|
if choices and graphene_settings.GRAPHENE_CONVERT_CHOICES_TO_ENUMS:
|
||||||
meta = field.model._meta
|
meta = field.model._meta
|
||||||
name = to_camel_case("{}_{}".format(meta.object_name, field.name))
|
name = to_camel_case("{}_{}".format(meta.object_name, field.name))
|
||||||
choices = list(get_choices(choices))
|
choices = list(get_choices(choices))
|
||||||
|
|
|
@ -35,6 +35,7 @@ DEFAULTS = {
|
||||||
"RELAY_CONNECTION_ENFORCE_FIRST_OR_LAST": False,
|
"RELAY_CONNECTION_ENFORCE_FIRST_OR_LAST": False,
|
||||||
# Max items returned in ConnectionFields / FilterConnectionFields
|
# Max items returned in ConnectionFields / FilterConnectionFields
|
||||||
"RELAY_CONNECTION_MAX_LIMIT": 100,
|
"RELAY_CONNECTION_MAX_LIMIT": 100,
|
||||||
|
"GRAPHENE_CONVERT_CHOICES_TO_ENUMS": True,
|
||||||
}
|
}
|
||||||
|
|
||||||
if settings.DEBUG:
|
if settings.DEBUG:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user