Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fix broken 'get_choices' with restframework 3.15.0 #1506

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions graphene_django/converter.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import inspect
from collections import OrderedDict
from functools import partial, singledispatch, wraps

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

def get_choices(choices):
converted_names = []
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)
Expand Down
Loading