From 9f2f00e9f8188a9010cfa96460ee7528a4d8a49c Mon Sep 17 00:00:00 2001 From: a-c-sreedhar-reddy Date: Wed, 4 Mar 2020 10:31:47 +0530 Subject: [PATCH] refactor _convert_choices_to_enum calculation. --- graphene_django/types.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/graphene_django/types.py b/graphene_django/types.py index 967d8fb..8e2a055 100644 --- a/graphene_django/types.py +++ b/graphene_django/types.py @@ -45,11 +45,11 @@ def construct_fields( # in there. Or when we exclude this field in exclude_fields. # Or when there is no back reference. continue - _convert_choices_to_enum = convert_choices_to_enum - if not isinstance(_convert_choices_to_enum, bool): - # then `convert_choices_to_enum` is a list of field names to convert - _convert_choices_to_enum = name in _convert_choices_to_enum - + _convert_choices_to_enum = ( + convert_choices_to_enum + if isinstance(convert_choices_to_enum, bool) + else name in convert_choices_to_enum + ) converted = convert_django_field_with_choices( field, registry, convert_choices_to_enum=_convert_choices_to_enum )