Skip to content

Commit 7f65985

Browse files
committed
Use Django forcetext for choices
1 parent be449ab commit 7f65985

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

graphene/contrib/django/converter.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from django.db import models
2+
from django.utils.encoding import force_text
23

34
from ...core.classtypes.enum import Enum
45
from ...core.types.custom_scalars import DateTime, JSONString
@@ -14,7 +15,7 @@
1415

1516
def convert_choices(choices):
1617
for value, name in choices:
17-
yield to_const(name), value
18+
yield to_const(force_text(name)), value
1819

1920

2021
def convert_django_field_with_choices(field):

graphene/utils/str_converters.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ def to_snake_case(name):
1818

1919

2020
def to_const(string):
21-
return re.sub('[\W|^]+', '_', string.format()).upper()
21+
return re.sub('[\W|^]+', '_', string).upper()

0 commit comments

Comments
 (0)