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. LeetCode-1765 地图中的最高点

    来源:力扣(LeetCode)链接:https://leetcode-cn.com/problems/map-of-highest-peak 题目描述 给你一个大小为 m x n 的整数矩阵 isWa ...

  2. Unity的超大开放世界解决方案

    https://blog.csdn.net/u011105442/article/details/104614043

  3. 个人常用的git提交代码流程

    # 增加⼀一个新的远程仓库,并命名git remote add [shortname] [url] # 新建一个本地目录,将其初始化为 Git 代码库$ git init [project-name] ...

  4. 【FPGA学习】MATLAB与FPGA实现FIR滤波器

    本篇博客记录一下在matlab设计和在FPGA平台实现FIR滤波器的方法,平台是Xilinx的ZYNQ 参考: AMBA AXI-Stream Protocol Specification 使用mat ...

  5. oracle 行转列,动态年份,月份列。已解决!

    -----------------存储过程包体----------- procedure GetComparativeAnalysisTB(p_StartTime varchar2, ----开始时间 ...

  6. Java Development Kit下载地址

    Java Development Kit下载地址 官网下载 一般最新版本无需登录即可下载,其他历史版本需要登录Oracle账户才可以下载. 最新版下载地址: https://www.oracle.co ...

  7. win10安装双版本mysql的方法

    因为app作业缘故,之前装的mysql8.0版本无法兼容因此打算再装一个5.7版本的mysql,历经3,4天终于成功,现记录下这血一般的教训 首先官网下再mysql5.7.37的安装包 下载地址htt ...

  8. .net code 3.0 获取配置文件 json 和 config 中的值

    using Microsoft.Extensions.Configuration;using Microsoft.Extensions.FileProviders; using System.IO; ...

  9. JQery easyUI 滚动分页

    var s1 = new Date().getTime();     $(document).ready(function(){        var flag = true;        //鼠标 ...

  10. Postman配置多环境请求地址

    在使用Postman测试接口时,一个项目往往有多个环境(测试.正式等),请求不同环境的接口一般只是IP和端口不一样. 这时候我们可以定义多个环境变量,在接口地址中进行引用. 一.添加环境变量 1.点击 ...