diff options
| author | Tom Christie | 2012-12-08 12:48:38 +0000 |
|---|---|---|
| committer | Tom Christie | 2012-12-08 12:48:38 +0000 |
| commit | 733f03fba35cb13ad53723b0b15d439e40da32ad (patch) | |
| tree | e319c3c8811e51469260269ca9b2b38ec3d67a4b | |
| parent | 936fdfb78e6987ce18812fbe3e17e2af8822704e (diff) | |
| download | django-rest-framework-733f03fba35cb13ad53723b0b15d439e40da32ad.tar.bz2 | |
Fix for emptystring as nullable FK
| -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 bffc0fb0..c5726ff0 100644 --- a/rest_framework/fields.py +++ b/rest_framework/fields.py @@ -351,9 +351,9 @@ class RelatedField(WritableField): value = data.get(field_name) - if value is None and not self.blank: + if value in (None, '') and not self.blank: raise ValidationError('Value may not be null') - elif value is None and self.blank: + elif value in (None, '') and self.blank: into[(self.source or field_name)] = None else: into[(self.source or field_name)] = self.from_native(value) |
