mirror of
https://github.com/graphql-python/graphene-django.git
synced 2024-11-22 17:47:12 +03:00
Handles multiple collisions with the same key.
This commit is contained in:
parent
2c26774c62
commit
89d0f0ca92
|
@ -34,7 +34,7 @@ def get_choices(choices):
|
||||||
yield choice
|
yield choice
|
||||||
else:
|
else:
|
||||||
name = convert_choice_name(value)
|
name = convert_choice_name(value)
|
||||||
if name in converted_names:
|
while name in converted_names:
|
||||||
name += '_' + str(len(converted_names))
|
name += '_' + str(len(converted_names))
|
||||||
converted_names.append(name)
|
converted_names.append(name)
|
||||||
description = help_text
|
description = help_text
|
||||||
|
|
|
@ -178,6 +178,7 @@ def test_field_with_choices_gettext():
|
||||||
|
|
||||||
def test_field_with_choices_collision():
|
def test_field_with_choices_collision():
|
||||||
field = models.CharField(help_text='Timezone', choices=(
|
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'),
|
||||||
('Etc/GMT-1', 'Greenwich Mean Time -1'),
|
('Etc/GMT-1', 'Greenwich Mean Time -1'),
|
||||||
))
|
))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user