From e24d29ec05fd3fa7cc12533929dc1b68e9d56f9a Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Wed, 30 Jan 2013 14:21:18 +0000 Subject: [PATCH] Tweak empty list implementation --- rest_framework/relations.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rest_framework/relations.py b/rest_framework/relations.py index 221c72fba..046b0db17 100644 --- a/rest_framework/relations.py +++ b/rest_framework/relations.py @@ -129,8 +129,8 @@ class RelatedField(WritableField): try: # Form data value = data.getlist(field_name) - if value == ['']: - value = [] + if value == [''] or value == []: + raise KeyError except AttributeError: # Non-form data value = data[field_name]