diff options
| author | Tom Christie | 2014-09-22 16:50:04 +0100 |
|---|---|---|
| committer | Tom Christie | 2014-09-22 16:50:04 +0100 |
| commit | b5454dd02290130a7fb0a0e375f3efecc58edc6d (patch) | |
| tree | 83fcf468d35169df3547caff4f42881e7c27560a /rest_framework | |
| parent | e5f0a97595ff9280c7876fc917f6feb27b5ea95d (diff) | |
| download | django-rest-framework-b5454dd02290130a7fb0a0e375f3efecc58edc6d.tar.bz2 | |
Tests and tweaks for choice fields
Diffstat (limited to 'rest_framework')
| -rw-r--r-- | rest_framework/fields.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/rest_framework/fields.py b/rest_framework/fields.py index 12975ae4..500018f3 100644 --- a/rest_framework/fields.py +++ b/rest_framework/fields.py @@ -750,7 +750,7 @@ class ChoiceField(Field): self.fail('invalid_choice', input=data) def to_representation(self, value): - return value + return self.choice_strings_to_values[str(value)] class MultipleChoiceField(ChoiceField): @@ -769,7 +769,7 @@ class MultipleChoiceField(ChoiceField): ]) def to_representation(self, value): - return value + return [self.choice_strings_to_values[str(item)] for item in value] # File types... |
