Hi. Given:
RATING_CHOICES = (
(0, ''), # or (0 'none')
(1, '*'),
(2, '**'),
(3, '***'),
(4, '****'),
(5, '*****')
)
class Note(models.Model):
rating = models.IntegerField(choices=RATING_CHOICES, blank=True, default=0)
# ...
class NoteNode(DjangoObjectType):
class Meta:
model = Note
interfaces = (relay.Node,)
# fails when loading the schema
from mattermind.schema import schema
choices [(0, 0, ''), (1, 1, '*'), (2, 2, '**'), (3, 3, '***'), (4, 4, '****'), (5, 5, '*****')]
named_choices [(0, 0), (1, 1), (2, 2), (3, 3), (4, 4), (5, 5)]
named_choices_descriptions {0: '', 1: '*', 2: '**', 3: '***', 4: '****', 5: '*****'}
Traceback (most recent call last):
File "try_schema.py", line 13, in <module>
def convert_choice_name(name):
File "/Users/crucial/miniconda3/envs/mattermind/lib/python3.5/site-packages/graphene/types/enum.py", line 41, in __call__
return cls.from_enum(PyEnum(*args, **kwargs), description=description)
File "/Users/crucial/miniconda3/envs/mattermind/lib/python3.5/enum.py", line 243, in __call__
return cls._create_(value, names, module=module, qualname=qualname, type=type, start=start)
File "/Users/crucial/miniconda3/envs/mattermind/lib/python3.5/enum.py", line 342, in _create_
classdict[member_name] = member_value
File "/Users/crucial/miniconda3/envs/mattermind/lib/python3.5/enum.py", line 60, in __setitem__
if _is_sunder(key):
File "/Users/crucial/miniconda3/envs/mattermind/lib/python3.5/enum.py", line 26, in _is_sunder
return (name[0] == name[-1] == '_' and
TypeError: 'int' object is not subscriptable
graphene
graphene-django
django_graphiql
graphql-core
django==1.9
django-filter==0.11.0
python 3.5