[Update] 修改导入bug

pull/3121/head
ibuler 2019-08-14 20:23:02 +08:00
parent a315df29ca
commit 8fb0d6315d
1 changed files with 4 additions and 1 deletions

View File

@ -49,6 +49,9 @@ class BulkListSerializerMixin(object):
"""
List of dicts of native values <- List of dicts of primitive datatypes.
"""
if not self.instance:
return super().to_internal_value(data)
if html.is_html_input(data):
data = html.parse_html_list(data)
@ -81,7 +84,7 @@ class BulkListSerializerMixin(object):
pk = item["pk"]
else:
raise ValidationError("id or pk not in data")
child = self.instance.get(id=pk)
child = self.instance.get(id=pk) if self.instance else None
self.child.instance = child
self.child.initial_data = item
# raw