关于导入时不自动填写部门和创建人的问题

发布于 2022-06-23 18:49:09

建议修改import_export_mixin.py第79行,加上request=request

        for ele in data:
            # 获取 unique 字段
            filter_dic = {i: ele.get(i) for i in list(set(self.import_field_dict.keys()) & set(unique_list))}
            instance = filter_dic and queryset.filter(**filter_dic).first()
            if instance and not updateSupport:
                continue
            if not filter_dic:
                instance = None
            serializer = self.import_serializer_class(instance, data=ele, request=request)
            serializer.is_valid(raise_exception=True)
            serializer.save()
        return DetailResponse(msg=f"导入成功!")

查看更多

关注者
0
被浏览
786
1 个回答
hongzai
hongzai 认证专家 2022-06-25
life is coding,外包,远程协助,咨询添加微信:H0nGzA1

bug的话到gitee去提issue

撰写答案

请登录后再发布答案,点击登录

发布
问题

分享
好友

手机
浏览

扫码手机浏览