From 570187b959575822febf838464ea46282cf21654 Mon Sep 17 00:00:00 2001 From: Petros Moisiadis Date: Thu, 26 Nov 2015 17:07:57 +0200 Subject: [PATCH] Updated NestedBoundField to also handle empty string when rendering its form If a NestedBoundField field has a value of `None` and is inside another NestedBoundField field, it will have its value converted to an empty string while the form of its enclosing field is being rendered. So, NestedBoundField fields with an empty string value must be handled the same way as NestedBoundField fields with a `None` value. --- rest_framework/utils/serializer_helpers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rest_framework/utils/serializer_helpers.py b/rest_framework/utils/serializer_helpers.py index b11d3fd0..cfaeb25e 100644 --- a/rest_framework/utils/serializer_helpers.py +++ b/rest_framework/utils/serializer_helpers.py @@ -90,7 +90,7 @@ class NestedBoundField(BoundField): """ def __init__(self, field, value, errors, prefix=''): - if value is None: + if value is None or value is '': value = {} super(NestedBoundField, self).__init__(field, value, errors, prefix)