Browse Source

fix: 修复资产平台导入失败的问题(ID没有返回)

pull/11026/head
Bai 1 year ago committed by Bryan
parent
commit
23361fdba9
  1. 5
      apps/common/drf/parsers/base.py

5
apps/common/drf/parsers/base.py

@ -52,14 +52,15 @@ class BaseFileParser(BaseParser):
fields_map = {}
fields = self.serializer_fields
for k, v in fields.items():
if v.read_only:
# 资产平台的 id 是只读的, 导入更新资产平台会失败
if v.read_only and k not in ['id', 'pk']:
continue
fields_map.update({
v.label: k,
k: k
})
field_names = [
fields_map.get(column_title.strip('*'), '')
fields_map.get(column_title.strip('*').lower(), '')
for column_title in column_titles
]
return field_names

Loading…
Cancel
Save