From f9252e3c4e70537514de92f4cfe6703a406c91fc Mon Sep 17 00:00:00 2001 From: Jonathan Kim Date: Wed, 22 Jan 2020 10:28:35 +0000 Subject: [PATCH] Rename setting --- graphene_django/converter.py | 2 +- graphene_django/settings.py | 2 +- graphene_django/tests/test_converter.py | 4 ++-- graphene_django/tests/test_types.py | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/graphene_django/converter.py b/graphene_django/converter.py index a586e8b..0492ce2 100644 --- a/graphene_django/converter.py +++ b/graphene_django/converter.py @@ -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_V3_NAMING is True: + if graphene_settings.DJANGO_CHOICE_FIELD_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, diff --git a/graphene_django/settings.py b/graphene_django/settings.py index 1b579dd..75b5fa3 100644 --- a/graphene_django/settings.py +++ b/graphene_django/settings.py @@ -37,7 +37,7 @@ DEFAULTS = { "RELAY_CONNECTION_MAX_LIMIT": 100, "CAMELCASE_ERRORS": False, # Set to True to enable v3 naming convention for choice field Enum's - "CHOICES_TO_ENUM_V3_NAMING": False, + "DJANGO_CHOICE_FIELD_ENUM_V3_NAMING": False, } if settings.DEBUG: diff --git a/graphene_django/tests/test_converter.py b/graphene_django/tests/test_converter.py index bbda2e3..1eb1e3f 100644 --- a/graphene_django/tests/test_converter.py +++ b/graphene_django/tests/test_converter.py @@ -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_V3_NAMING = True + graphene_settings.DJANGO_CHOICE_FIELD_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_V3_NAMING = False + graphene_settings.DJANGO_CHOICE_FIELD_ENUM_V3_NAMING = False diff --git a/graphene_django/tests/test_types.py b/graphene_django/tests/test_types.py index 800863b..368ae83 100644 --- a/graphene_django/tests/test_types.py +++ b/graphene_django/tests/test_types.py @@ -496,7 +496,7 @@ class TestDjangoObjectType: ) def test_django_objecttype_convert_choices_enum_naming_collisions(self, PetModel): - graphene_settings.CHOICES_TO_ENUM_V3_NAMING = True + graphene_settings.DJANGO_CHOICE_FIELD_ENUM_V3_NAMING = True class PetModelKind(DjangoObjectType): class Meta: @@ -529,7 +529,7 @@ class TestDjangoObjectType: } """ ) - graphene_settings.CHOICES_TO_ENUM_V3_NAMING = False + graphene_settings.DJANGO_CHOICE_FIELD_ENUM_V3_NAMING = False def test_django_objecttype_choices_override_enum(self, PetModel): def convert_choice(model, field_name, **kwargs):