Skip to content

Commit

Permalink
Use Django forcetext for choices
Browse files Browse the repository at this point in the history
  • Loading branch information
syrusakbary committed Jun 1, 2016
1 parent be449ab commit 7f65985
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion 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
Expand All @@ -14,7 +15,7 @@

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):
Expand Down
2 changes: 1 addition & 1 deletion graphene/utils/str_converters.py
Expand Up @@ -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()

0 comments on commit 7f65985

Please sign in to comment.