diff --git a/graphene/contrib/django/converter.py b/graphene/contrib/django/converter.py index 65ad8237..951af2ad 100644 --- a/graphene/contrib/django/converter.py +++ b/graphene/contrib/django/converter.py @@ -1,4 +1,5 @@ from django.db import models +from django.utils.encoding import force_text from ...core.classtypes.enum import Enum from ...core.types.custom_scalars import DateTime, JSONString @@ -14,7 +15,7 @@ singledispatch = import_single_dispatch() def convert_choices(choices): for value, name in choices: - yield to_const(name), value + yield to_const(force_text(name)), value def convert_django_field_with_choices(field): diff --git a/graphene/utils/str_converters.py b/graphene/utils/str_converters.py index d3a58e6c..ae8ceffe 100644 --- a/graphene/utils/str_converters.py +++ b/graphene/utils/str_converters.py @@ -18,4 +18,4 @@ def to_snake_case(name): def to_const(string): - return re.sub('[\W|^]+', '_', string.format()).upper() + return re.sub('[\W|^]+', '_', string).upper()