diff --git a/graphene_django/converter.py b/graphene_django/converter.py index addaec3..92812d1 100644 --- a/graphene_django/converter.py +++ b/graphene_django/converter.py @@ -34,7 +34,7 @@ def get_choices(choices): yield choice else: name = convert_choice_name(value) - if name in converted_names: + while name in converted_names: name += '_' + str(len(converted_names)) converted_names.append(name) description = help_text diff --git a/graphene_django/tests/test_converter.py b/graphene_django/tests/test_converter.py index b3ddf40..997b03c 100644 --- a/graphene_django/tests/test_converter.py +++ b/graphene_django/tests/test_converter.py @@ -178,6 +178,7 @@ def test_field_with_choices_gettext(): def test_field_with_choices_collision(): field = models.CharField(help_text='Timezone', choices=( + ('Etc/GMT+1+2', 'Fake choice to produce double collision'), ('Etc/GMT+1', 'Greenwich Mean Time +1'), ('Etc/GMT-1', 'Greenwich Mean Time -1'), ))