mirror of
https://github.com/graphql-python/graphene.git
synced 2024-11-27 03:53:56 +03:00
Fix ugettext_lazy objects in Choice tuples not being evaluated. Running .format() on it will return the string we want, and wont cause any problems when its run on a string without arguments
This commit is contained in:
parent
0f94f2b2ef
commit
be449ab1c0
|
@ -1,6 +1,12 @@
|
|||
from __future__ import absolute_import
|
||||
|
||||
from django.db import models
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
CHOICES = (
|
||||
(1, 'this'),
|
||||
(2, _('that'))
|
||||
)
|
||||
|
||||
|
||||
class Pet(models.Model):
|
||||
|
@ -22,6 +28,7 @@ class Reporter(models.Model):
|
|||
last_name = models.CharField(max_length=30)
|
||||
email = models.EmailField()
|
||||
pets = models.ManyToManyField('self')
|
||||
a_choice = models.CharField(max_length=30, choices=CHOICES)
|
||||
|
||||
def __str__(self): # __unicode__ on Python 2
|
||||
return "%s %s" % (self.first_name, self.last_name)
|
||||
|
|
|
@ -18,4 +18,4 @@ def to_snake_case(name):
|
|||
|
||||
|
||||
def to_const(string):
|
||||
return re.sub('[\W|^]+', '_', string).upper()
|
||||
return re.sub('[\W|^]+', '_', string.format()).upper()
|
||||
|
|
Loading…
Reference in New Issue
Block a user