Merge branch 'main' into patch-1

This commit is contained in:
Kien Dang 2024-03-18 10:02:02 +08:00 committed by GitHub
commit cbe59b29db
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 3 deletions

View File

@ -1,5 +1,5 @@
graphene>=2.1,<3
graphene-django>=2.1,<3
graphql-core>=2.1,<3
django==3.1.14
django==3.2.24
django-filter>=2

View File

@ -1,5 +1,4 @@
import inspect
from collections import OrderedDict
from collections.abc import Callable
from functools import partial, singledispatch, wraps
@ -75,8 +74,13 @@ def get_choices(choices):
converted_names = []
if isinstance(choices, Callable):
choices = choices()
if isinstance(choices, OrderedDict):
# In restframework==3.15.0, choices are not passed
# as OrderedDict anymore, so it's safer to check
# for a dict
if isinstance(choices, dict):
choices = choices.items()
for value, help_text in choices:
if isinstance(help_text, (tuple, list)):
yield from get_choices(help_text)