fix KeyError

This commit is contained in:
Matt Bartolome 2015-02-18 08:39:31 -08:00
parent 4bc3c2354a
commit da9daa7002

View File

@ -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...