From 0d32406445b5f0a53d287c20142e28d4b1fa4cb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ana=C3=ABl=20Beutot?= Date: Thu, 12 May 2016 12:24:24 +0200 Subject: [PATCH] serializers: fix ListSerializer.get_value It should return `empty` for non present field on partial updates when using HTML input. --- rest_framework/serializers.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rest_framework/serializers.py b/rest_framework/serializers.py index 8c475e91c..2f7e868c7 100644 --- a/rest_framework/serializers.py +++ b/rest_framework/serializers.py @@ -545,6 +545,10 @@ class ListSerializer(BaseSerializer): # We override the default field access in order to support # lists in HTML forms. if html.is_html_input(dictionary): + if self.field_name not in dictionary: + if getattr(self.root, 'partial', False): + return empty + return html.parse_html_list(dictionary, prefix=self.field_name) return dictionary.get(self.field_name, empty)