From 06fd63dade20e1a19276b7414a54b9f5d2ef8329 Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Tue, 25 Nov 2014 11:14:28 +0000 Subject: [PATCH] Don't use default_empty_html value for partial updates. Closes #2118. --- rest_framework/fields.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/rest_framework/fields.py b/rest_framework/fields.py index 778bc71878..3cf3488659 100644 --- a/rest_framework/fields.py +++ b/rest_framework/fields.py @@ -262,7 +262,11 @@ def get_value(self, dictionary): if html.is_html_input(dictionary): # HTML forms will represent empty fields as '', and cannot # represent None or False values directly. - ret = dictionary.get(self.field_name, '') + if self.field_name not in dictionary: + if getattr(self.root, 'partial', False): + return empty + return self.default_empty_html + ret = dictionary[self.field_name] return self.default_empty_html if (ret == '') else ret return dictionary.get(self.field_name, empty)