django.db.models.fields.related.ForeignObject.__init__() got multiple values for keyword argument 'to_fields'

原因:使用了to_fields

说明:使用外键关联字段时,应该使用to_field,而不是to_fields

错误示例

worker = models.ForeignKey(verbose_name="负责人",to="UserInfo",to_fields="name",on_delete=models.CASCADE)

正确示例

worker = models.ForeignKey(verbose_name="负责人",to="UserInfo",to_fields="name",on_delete=models.CASCADE)

got multiple values for keyword argument 'to_fields'的更多相关文章

  1. TypeError: test() got multiple values for keyword argument 'key'

    原因是: 1.函数调用的最终形式只会调用两个函数.一个list参数和一个dict参数,格式为call(func, list, dict); 2.如果传入参数中有key参数,那么首先key参数(包括扩展 ...

  2. python报错 TypeError: a() got multiple values for argument 'name'

    [问题现象] 在一次调用修饰函数中出现了问题,折腾了一下午,一直报错 TypeError:  got multiple values for argument 只是很简单的调用 from tsu2Ru ...

  3. 细说 PEP 468: Preserving Keyword Argument Order

    细说 PEP 468: Preserving Keyword Argument Order Python 3.6.0 版本对字典做了优化,新的字典速度更快,占用内存更少,非常神奇.从网上找了资料来看, ...

  4. senlin __init__() got an unexpected keyword argument 'additional_headers'

    从senlin源码重新编译更新了服务,然后执行 senlin的 cli就遇到了错误: __init__() got an unexpected keyword argument 'additional ...

  5. TypeError: 'encoding' is an invalid keyword argument for this function

    python 2.7 问题 data_file = open("F:\\MyPro\\data.yaml", "r", encoding='utf-8') 运行 ...

  6. TypeError: parse() got an unexpected keyword argument 'transport_encoding'

    错误: TypeError: parse() got an unexpected keyword argument 'transport_encoding'You are using pip vers ...

  7. get() got an unexpected keyword argument

    TypeError: get() got an unexpected keyword argument 'news_id'ERROR basehttp 154 "GET /news/3/ H ...

  8. TypeError: __init__() got an unexpected keyword argument 't_command'

    python  .\manage.py migrate 报错如下 λ python .\manage.py migrateTraceback (most recent call last): File ...

  9. TypeError: while_loop() got an unexpected keyword argument 'maximum_iterations'

    错误: TypeError: while_loop() got an unexpected keyword argument 'maximum_iterations' 参照https://blog.c ...

  10. Django--bug--__init__() got an unexpected keyword argument 'qnique'

    建立模型之后,执行迁移,报如下错误: __init__() got an unexpected keyword argument 'qnique' 错误原因:模型的属性的约束添加错误,这种错误一般就是 ...

随机推荐

  1. js高德地图添加点Marker,添加线段Polyline,添加一个区域Polygon(面)

    高德地图JS API 实例  亲测可用 参考网站=> 阿里云数据可视化平台(下载json用的):http://datav.aliyun.com/portal/school/atlas/area_ ...

  2. RTFormer: Efficient Design for Real-Time Semantic Segmentation with Transformer概述

    0.前言 相关资料: arxiv github 论文解读 论文基本信息: 发表时间:NeurlPS2022(2022.10.13) 1.摘要 最近,基于Transformer的网络在语义分割方面取得了 ...

  3. 看图王 10.9.1.9791 With X64 去广告绿色版

    修改历史:2022.12.14:自改官方 10.9.1.9791 最新正式版本2022.06.18:首个自改官方 10.9.0.9760 修改内容:美化部分关联图标:基于官方最新版本制作,精简部分非必 ...

  4. Cisco ASA防火墙恢复密码和基本配置

    Cisco ASA密码恢复 一.思路 Cisco ASA防火墙密码恢复,与路由器相似 修改寄存器的值,绕过startup-config配置文件 重新修改密码 恢复修改寄存器的值,保存配置 二.操作步骤 ...

  5. Django基础(1)

    一.开发模式 MVC模式: model:数据库 view:前端展示 controller:逻辑控制 MTV模式(Django): model:数据库 view:逻辑控制 template:前端展示(模 ...

  6. LinuxK8S集群搭建三(部署dashboard)

    系统环境: CentOS 7 64位 准备工作: 通过虚拟机创建三台CentOS服务器,可参照之前的文章192.168.28.128 --master192.168.28.130 --node0119 ...

  7. LP1-5:测试设计

    在接到产品需求进行开发前,怎么样才能最大程度的降低开发错误或明显bug的情况? 答案是在「开发前做设计」. 通常,一个功能的设计要包含几个方面: 1.已有功能情况 2.需求情况 3.数据库设计 4.接 ...

  8. 2022-05-11内部群每日三题-清辉PMP

    1.一个低概率/高影响的技术风险发生了. 项目经理该怎么做? A. 提交变更请求来调整成本和进度基准 B. 进行风险审查,评估其对项目可交付成果的影响 C. 实施风险登记册中概述的减轻计划 D. 查询 ...

  9. 10. watch的实现原理

    watch的实现原理 watch和computed一样, 也是基于 Watcher 的 组件内部使用的watch 和 外部使用的 vm.$watch()都是调用的Vue.prototype.$watc ...

  10. DP4056软硬兼容TP4056,低成本

    概述 DP4056是一款单节锂离子电池恒流/恒压线性充电器,采用底 部带散热片的SOP8封装以及简单的外部应用电路,常适 合便携式设备应用,适合USB电源和适配器电源工作,内部采用防倒充电路,不需要外 ...