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. LRU 居然翻译成最近最少使用?真相原来是这样!(附力扣题解)

    前言 相信有很多同学和我一样,第一次碰到 LRU(Least Recently Used) 的这个解释「最近最少使用」都不知道是什么意思,用汤家凤老师的话来说: 我真的感到匪夷所思啊! 最近是表示时间 ...

  2. ASP.NET Core - 依赖注入(三)

    4. 容器中的服务创建与释放 我们使用了 IoC 容器之后,服务实例的创建和销毁的工作就交给了容器去处理,前面也讲到了服务的生命周期,那三种生命周期中对象的创建和销毁分别在什么时候呢.以下面的例子演示 ...

  3. 解决MySQL5.5MySQLInstanceConfig最后一步setting报错

    问题描述 在安装过MySQL(或已卸载)的电脑中重新安装MySQL5.5, 在安装最后一项中Processing configuration中最后一项配置失败: 问题解决: 首先关于卸载: 安装时候若 ...

  4. centos7.8GPU服务器搭建

    首先官方文档有cuda驱动和toolkit和Linux内核本,gcc版本的对应关系,其中也有一些安装过程可参考: https://developer.nvidia.com/cuda-toolkit-a ...

  5. vue3 使用clodop打印插件实现不预览直接打印

    一.下载安装C-LODOP https://www.lodop.net/download.html 解压文件后点击exe程序,启用服务 将上述的 LodopFuncs.js 文件放到工程某个文件下 二 ...

  6. 083_SFDC Limit(二) 及良好的开发习惯

    关于常见开发中遇到的limit,应如何处理:https://developer.salesforce.com/page/Apex_Code_Best_Practices 链接内容很好,就不一一做解释 ...

  7. VUE+Element+若依随笔001:点击左侧菜单跳转外部链接配置并传参数

    一.后台菜单配置部分:1.菜单管理中:新增父级目录2.配置内容: 菜单名称:测试用菜单 菜单路径:https://www.baidu.com/ 此处需要配置要跳转你的外部链接 组件名称:testMen ...

  8. Linux中启动Docker容器报错:Error response from daemon: driver failed programming external connectivity

    在启动Docker的容器时,会出现报错:Error response from daemon: driver failed programming external connectivity on e ...

  9. UF_CURVE_ask_arc_data圆弧角度

    1 UF_CURVE_arc_t Obj_data; 2 UF_CURVE_ask_arc_data(tObject[i], &Obj_data); 3 double Sp = Obj_dat ...

  10. 初学银河麒麟linux笔记 第七章 VMWare虚拟机内的qt程序连接串口和网口

    QT程序可以正常在虚拟机里的麒麟系统里运行了,但是无法连接网口和串口,这里进行配置 网口连接 与硬件的TCP连接,在虚拟机上设置桥接 再重启就能连上了 串口连接 首先参考 https://blog.c ...