Skip to content

Commit 4936e40

Browse files
committed
Merge branch 'django-choices-translation' of https://github.com/Ian-Foote/graphene into fix_lazy_translated_choice
2 parents 7f65985 + 8744f6a commit 4936e40

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

graphene/contrib/django/tests/test_converter.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import pytest
22
from django.db import models
3+
from django.utils.translation import ugettext_lazy as _
34
from py.test import raises
45

56
import graphene
@@ -117,6 +118,21 @@ class Meta:
117118
assert graphene_type.__enum__.__members__['ENGLISH'].value == 'en'
118119

119120

121+
def test_field_with_choices_gettext():
122+
field = models.CharField(help_text='Language', choices=(
123+
('es', _('Spanish')),
124+
('en', _('English'))
125+
))
126+
127+
class TranslatedModel(models.Model):
128+
language = field
129+
130+
class Meta:
131+
app_label = 'test'
132+
133+
convert_django_field_with_choices(field)
134+
135+
120136
def test_should_float_convert_float():
121137
assert_conversion(models.FloatField, graphene.Float)
122138

0 commit comments

Comments
 (0)