Skip to content

Commit

Permalink
Don't use default_empty_html value for partial updates. Closes #2118.
Browse files Browse the repository at this point in the history
  • Loading branch information
tomchristie committed Nov 25, 2014
1 parent 17c7431 commit 06fd63d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion rest_framework/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

2 comments on commit 06fd63d

@davidfischer-ch
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just tested it with my own integration tests and it works. Thanks.

@tomchristie
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Please sign in to comment.