mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-06 05:20:12 +03:00
fix KeyError
This commit is contained in:
parent
4bc3c2354a
commit
da9daa7002
|
@ -1051,10 +1051,12 @@ class MultipleChoiceField(ChoiceField):
|
|||
])
|
||||
|
||||
def to_representation(self, value):
|
||||
return set([
|
||||
self.choice_strings_to_values[six.text_type(item)] for item in value
|
||||
])
|
||||
|
||||
if value in ('', None):
|
||||
return value
|
||||
try:
|
||||
return self.choice_strings_to_values[six.text_type(value)]
|
||||
except KeyError:
|
||||
return value
|
||||
|
||||
# File types...
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user