Browse Source

perf: 优化批量更新会查询全部数据的问题

pull/5592/head^2
xinwen 4 years ago committed by 老广
parent
commit
d795867916
  1. 4
      apps/common/mixins/serializers.py

4
apps/common/mixins/serializers.py

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

Loading…
Cancel
Save