got multiple values for keyword argument 'to_fields'
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'的更多相关文章
- TypeError: test() got multiple values for keyword argument 'key'
原因是: 1.函数调用的最终形式只会调用两个函数.一个list参数和一个dict参数,格式为call(func, list, dict); 2.如果传入参数中有key参数,那么首先key参数(包括扩展 ...
- python报错 TypeError: a() got multiple values for argument 'name'
[问题现象] 在一次调用修饰函数中出现了问题,折腾了一下午,一直报错 TypeError: got multiple values for argument 只是很简单的调用 from tsu2Ru ...
- 细说 PEP 468: Preserving Keyword Argument Order
细说 PEP 468: Preserving Keyword Argument Order Python 3.6.0 版本对字典做了优化,新的字典速度更快,占用内存更少,非常神奇.从网上找了资料来看, ...
- senlin __init__() got an unexpected keyword argument 'additional_headers'
从senlin源码重新编译更新了服务,然后执行 senlin的 cli就遇到了错误: __init__() got an unexpected keyword argument 'additional ...
- TypeError: 'encoding' is an invalid keyword argument for this function
python 2.7 问题 data_file = open("F:\\MyPro\\data.yaml", "r", encoding='utf-8') 运行 ...
- TypeError: parse() got an unexpected keyword argument 'transport_encoding'
错误: TypeError: parse() got an unexpected keyword argument 'transport_encoding'You are using pip vers ...
- get() got an unexpected keyword argument
TypeError: get() got an unexpected keyword argument 'news_id'ERROR basehttp 154 "GET /news/3/ H ...
- TypeError: __init__() got an unexpected keyword argument 't_command'
python .\manage.py migrate 报错如下 λ python .\manage.py migrateTraceback (most recent call last): File ...
- TypeError: while_loop() got an unexpected keyword argument 'maximum_iterations'
错误: TypeError: while_loop() got an unexpected keyword argument 'maximum_iterations' 参照https://blog.c ...
- Django--bug--__init__() got an unexpected keyword argument 'qnique'
建立模型之后,执行迁移,报如下错误: __init__() got an unexpected keyword argument 'qnique' 错误原因:模型的属性的约束添加错误,这种错误一般就是 ...
随机推荐
- Windows 注册表是什么
注册表的概念 历史发展 在 Windows 3.x 操作系统中,注册表是一个极小文件,其文件名为 Reg.dat,里面只存放了某些文件类型的应用程序关联,大部分的设置是被放在 win.ini.syst ...
- 在github上如何克隆带子模块的项目?
使用命令git clone --recursive xxxx(项目地址).
- Java后台校验手机号和邮箱
//true是手机号,false不是手机号 public static boolean checkPhone(String phone){ Pattern p = Pattern.compile(&q ...
- winfrom快捷键
1.当活动窗体的快捷键 1 protected override bool ProcessCmdKey(ref Message msg, Keys keyData) 2 { 3 KeyEventArg ...
- Python3 时间戳格式化和减法运算
import datetime import time # 获取当前时间(2023-02-16 16:41:36) now_date = datetime.datetime.now().strftim ...
- openssl用法详解 【转】
原文: http://www.178linux.com/48764 OpenSSL 是一个开源项目,其组成主要包括一下三个组件: openssl:多用途的命令行工具 libcrypto:加密算法库 l ...
- windows运行xcopy计划任务 结果是0x4解决方案
近几天发现一直好好的数据备份计划任务一直返回0x4失败,直接执行bat又是正常的. bat命令中使用的是xcopy,到处找方案没解决. 今天意外在使用另一个命令时,发现提示:网络连接数据超过最大值. ...
- 安装centos,ubuntu系统
安装centos系统 1.首先进入VMware,新建虚拟机,选择典型,然后下一步 2.稍后安装系统,下一步 3.因为此次安装的是centos7.9系统,因此版本选择7 64位,下一步 4.选择虚拟机的 ...
- Unity3D调用Android功能与组件(10.1):应用自启动
前言 我在Unity3D调用Android功能与组件(十)-BroadcastReceiver中介绍了如何使用Unity接入广播. 然而很多没有做过Android的小伙伴却表示 [这是神马玩意儿?干啥 ...
- sort使用
用sort对结构体进行排序步骤如下 1.先写c++头文件 # include<iostream># include<algorithm> //这个是sort的头文件 using ...