mirror of
https://github.com/graphql-python/graphene-django.git
synced 2025-07-13 09:42:32 +03:00
support formatting of enum choices
This commit is contained in:
parent
0588f89b89
commit
14a5d62efd
|
@ -1,3 +1,5 @@
|
|||
import enum
|
||||
|
||||
from django.db import models
|
||||
from django.utils.encoding import force_text
|
||||
|
||||
|
@ -17,6 +19,8 @@ singledispatch = import_single_dispatch()
|
|||
|
||||
|
||||
def convert_choice_name(name):
|
||||
if isinstance(name, enum.Enum):
|
||||
name = name.name
|
||||
name = to_const(force_text(name))
|
||||
try:
|
||||
assert_valid_name(name)
|
||||
|
|
Loading…
Reference in New Issue
Block a user