aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/fields.py
diff options
context:
space:
mode:
authorTom Christie2014-11-19 09:31:26 +0000
committerTom Christie2014-11-19 09:31:26 +0000
commite49d22dbda5ac889ab89f277e17752c840819de2 (patch)
treeab5403244b16800bd9f1eb8821d312f135bf9aaf /rest_framework/fields.py
parentf573aaee4eabb9bf677c350219c8feb2333a6fa1 (diff)
downloaddjango-rest-framework-e49d22dbda5ac889ab89f277e17752c840819de2.tar.bz2
Allow blank choices to render. Closes #2071.
Diffstat (limited to 'rest_framework/fields.py')
-rw-r--r--rest_framework/fields.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/rest_framework/fields.py b/rest_framework/fields.py
index 36afe7a9..bb43708d 100644
--- a/rest_framework/fields.py
+++ b/rest_framework/fields.py
@@ -947,6 +947,8 @@ class ChoiceField(Field):
self.fail('invalid_choice', input=data)
def to_representation(self, value):
+ if value in ('', None):
+ return value
return self.choice_strings_to_values[six.text_type(value)]