Skip to content

Commit ac09cd2

Browse files
authored
fix: Fix broke 'get_choices' with restframework 3.15.0 (#1506)
1 parent 54372b4 commit ac09cd2

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

graphene_django/converter.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import inspect
2-
from collections import OrderedDict
32
from functools import partial, singledispatch, wraps
43

54
from django.db import models
@@ -72,8 +71,13 @@ def convert_choice_name(name):
7271

7372
def get_choices(choices):
7473
converted_names = []
75-
if isinstance(choices, OrderedDict):
74+
75+
# In restframework==3.15.0, choices are not passed
76+
# as OrderedDict anymore, so it's safer to check
77+
# for a dict
78+
if isinstance(choices, dict):
7679
choices = choices.items()
80+
7781
for value, help_text in choices:
7882
if isinstance(help_text, (tuple, list)):
7983
yield from get_choices(help_text)

0 commit comments

Comments
 (0)