From 27c93c08d2a9b791f9a5aef5f372194cb963d63c Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Wed, 3 Oct 2012 12:56:01 +0100 Subject: [PATCH] Fix for empty form fields --- rest_framework/fields.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rest_framework/fields.py b/rest_framework/fields.py index 5dc055fc0..8b495d6ee 100644 --- a/rest_framework/fields.py +++ b/rest_framework/fields.py @@ -250,7 +250,10 @@ class ManyPrimaryKeyRelatedField(PrimaryKeyRelatedField): value = data.getlist(field_name) except: value = data.get(field_name) - into[field_name] = [self.from_native(item) for item in value if item] + else: + if value == ['']: + value = [] + into[field_name] = [self.from_native(item) for item in value] class NaturalKeyRelatedField(RelatedField):