refactor _convert_choices_to_enum calculation.

This commit is contained in:
a-c-sreedhar-reddy 2020-03-04 10:31:47 +05:30
parent 040a48b1f3
commit 9f2f00e9f8

View File

@ -45,11 +45,11 @@ def construct_fields(
# in there. Or when we exclude this field in exclude_fields. # in there. Or when we exclude this field in exclude_fields.
# Or when there is no back reference. # Or when there is no back reference.
continue continue
_convert_choices_to_enum = convert_choices_to_enum _convert_choices_to_enum = (
if not isinstance(_convert_choices_to_enum, bool): convert_choices_to_enum
# then `convert_choices_to_enum` is a list of field names to convert if isinstance(convert_choices_to_enum, bool)
_convert_choices_to_enum = name in _convert_choices_to_enum else name in convert_choices_to_enum
)
converted = convert_django_field_with_choices( converted = convert_django_field_with_choices(
field, registry, convert_choices_to_enum=_convert_choices_to_enum field, registry, convert_choices_to_enum=_convert_choices_to_enum
) )