mirror of
https://github.com/graphql-python/graphene-django.git
synced 2025-07-02 03:13:13 +03:00
Fix for python 2.7
This commit is contained in:
parent
c7bb00dd1b
commit
105535b362
|
@ -69,7 +69,11 @@ def convert_choices_to_named_enum_with_descriptions(name, choices):
|
||||||
def description(self):
|
def description(self):
|
||||||
return named_choices_descriptions[self.name]
|
return named_choices_descriptions[self.name]
|
||||||
|
|
||||||
return Enum(name, list(named_choices), type=EnumWithDescriptionsType)
|
if named_choices == []:
|
||||||
|
# Python 2.7 doesn't handle enums with lists with zero entries, but works okay with empty sets
|
||||||
|
named_choices = set()
|
||||||
|
|
||||||
|
return Enum(name, named_choices, type=EnumWithDescriptionsType)
|
||||||
|
|
||||||
|
|
||||||
def generate_enum_name(django_model_meta, field):
|
def generate_enum_name(django_model_meta, field):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user