From c6d4bbbb4e1c864878c76d5ade7bdfb2b2dae92b Mon Sep 17 00:00:00 2001 From: Kazantcev Andrey <45011689+heckad@users.noreply.github.com> Date: Sun, 21 Mar 2021 15:11:18 +0300 Subject: [PATCH] Fix ignore display_name. Now thy map key to key. Not display_name to the key. --- rest_framework/fields.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rest_framework/fields.py b/rest_framework/fields.py index e4be54751..fd651da0c 100644 --- a/rest_framework/fields.py +++ b/rest_framework/fields.py @@ -1454,7 +1454,7 @@ class ChoiceField(Field): # Allows us to deal with eg. integer choices while supporting either # integer or string input, but still get the correct datatype out. self.choice_strings_to_values = { - str(key): key for key in self.choices + str(value): key for key, value in self.choices.items() } choices = property(_get_choices, _set_choices)