mirror of
https://github.com/graphql-python/graphene-django.git
synced 2025-04-24 02:52:04 +03:00
Rename settings field
This commit is contained in:
parent
8c20e183ad
commit
fdaa0bf2ba
|
@ -70,7 +70,7 @@ def convert_choices_to_named_enum_with_descriptions(name, choices):
|
|||
|
||||
|
||||
def generate_enum_name(django_model_meta, field):
|
||||
if graphene_settings.CHOICES_TO_ENUM_UNIQUE_TYPE_NAME is True:
|
||||
if graphene_settings.CHOICES_TO_ENUM_V3_NAMING is True:
|
||||
name = "DjangoModel{app_label}{object_name}{field_name}Choices".format(
|
||||
app_label=to_camel_case(django_model_meta.app_label.title()),
|
||||
object_name=django_model_meta.object_name,
|
||||
|
|
|
@ -36,8 +36,8 @@ DEFAULTS = {
|
|||
# Max items returned in ConnectionFields / FilterConnectionFields
|
||||
"RELAY_CONNECTION_MAX_LIMIT": 100,
|
||||
"CAMELCASE_ERRORS": False,
|
||||
# Set to True to enable unique naming for choice field Enum's
|
||||
"CHOICES_TO_ENUM_UNIQUE_TYPE_NAME": False,
|
||||
# Set to True to enable v3 naming convention for choice field Enum's
|
||||
"CHOICES_TO_ENUM_V3_NAMING": False,
|
||||
}
|
||||
|
||||
if settings.DEBUG:
|
||||
|
|
|
@ -335,7 +335,7 @@ def test_should_postgres_range_convert_list():
|
|||
|
||||
def test_generate_enum_name():
|
||||
MockDjangoModelMeta = namedtuple("DjangoMeta", ["app_label", "object_name"])
|
||||
graphene_settings.CHOICES_TO_ENUM_UNIQUE_TYPE_NAME = True
|
||||
graphene_settings.CHOICES_TO_ENUM_V3_NAMING = True
|
||||
|
||||
# Simple case
|
||||
field = graphene.Field(graphene.String, name="type")
|
||||
|
@ -352,4 +352,4 @@ def test_generate_enum_name():
|
|||
== "DjangoModelSomeLongAppNameSomeObjectFizzBuzzChoices"
|
||||
)
|
||||
|
||||
graphene_settings.CHOICES_TO_ENUM_UNIQUE_TYPE_NAME = False
|
||||
graphene_settings.CHOICES_TO_ENUM_V3_NAMING = False
|
||||
|
|
|
@ -496,7 +496,7 @@ class TestDjangoObjectType:
|
|||
)
|
||||
|
||||
def test_django_objecttype_convert_choices_enum_naming_collisions(self, PetModel):
|
||||
graphene_settings.CHOICES_TO_ENUM_UNIQUE_TYPE_NAME = True
|
||||
graphene_settings.CHOICES_TO_ENUM_V3_NAMING = True
|
||||
|
||||
class PetModelKind(DjangoObjectType):
|
||||
class Meta:
|
||||
|
@ -529,7 +529,7 @@ class TestDjangoObjectType:
|
|||
}
|
||||
"""
|
||||
)
|
||||
graphene_settings.CHOICES_TO_ENUM_UNIQUE_TYPE_NAME = False
|
||||
graphene_settings.CHOICES_TO_ENUM_V3_NAMING = False
|
||||
|
||||
def test_django_objecttype_choices_override_enum(self, PetModel):
|
||||
def convert_choice(model, field_name, **kwargs):
|
||||
|
|
Loading…
Reference in New Issue
Block a user