mirror of
https://github.com/graphql-python/graphene.git
synced 2024-11-27 03:53:56 +03:00
Fix field model
This commit is contained in:
parent
4936e40258
commit
edfbbf52ef
|
@ -20,8 +20,9 @@ def convert_choices(choices):
|
|||
|
||||
def convert_django_field_with_choices(field):
|
||||
choices = getattr(field, 'choices', None)
|
||||
if choices:
|
||||
meta = field.model._meta
|
||||
model = getattr(field, 'model', None)
|
||||
if choices and model:
|
||||
meta = model._meta
|
||||
name = '{}_{}_{}'.format(meta.app_label, meta.object_name, field.name)
|
||||
return Enum(name.upper(), list(convert_choices(choices)), description=field.help_text)
|
||||
return convert_django_field(field)
|
||||
|
|
|
@ -124,7 +124,7 @@ def test_field_with_choices_gettext():
|
|||
('en', _('English'))
|
||||
))
|
||||
|
||||
class TranslatedModel(models.Model):
|
||||
class TranslatedChoicesModel(models.Model):
|
||||
language = field
|
||||
|
||||
class Meta:
|
||||
|
|
Loading…
Reference in New Issue
Block a user