django报错TypeRError:__init__() missing 1 required positional argument: 'on_delete'
在添加外键的时候,在括号里添加on_delete=models.CASCADE即可
on_delete=models.CASCADE是级联删除的意思,意思就是说当你更新或删除主键表,那外键表也会跟随一起更新或删除。
django报错TypeRError:__init__() missing 1 required positional argument: 'on_delete'的更多相关文章
- Django报错:__init__() missing 1 required positional argument: 'on_delete'
原因: 在django2.0后,定义外键和一对一关系的时候需要加on_delete选项,此参数为了避免两个表里的数据不一致问题,不然会报错:TypeError: __init__() missing ...
- Django 生成数据库表时的报错TypeError: __init__() missing 1 required positional argument: 'on_delete'
原因及解决办法: https://www.cnblogs.com/phyger/p/8035253.html
- Django :执行 python manage.py makemigrations 时报错 TypeError: __init__() missing 1 required positional argument: 'on_delete'
原因 执行命令 python manage.py makemigrations 报错 TypeError: __init__() missing 1 required positional argum ...
- Django在根据models生成数据库表时报错: __init__() missing 1 required positional argument: 'on_delete'
原因: 在django2.0后,定义外键和一对一关系的时候需要加on_delete选项,此参数为了避免两个表里的数据不一致问题,不然会报错:TypeError: __init__() missing ...
- Django关联数据库时报错TypeError: __init__() missing 1 required positional argument: 'on_delete'
sgrade = models.ForeignKey("Grades",) 执行python manage.py makemigrations后出现TypeError: __ini ...
- 执行python manage.py makemigrations时报错TypeError: __init__() missing 1 required positional argument: 'on_delete'
在执行python manage.py makemigrations时报错: TypeError: __init__() missing 1 required positional argument: ...
- Django在根据models生成数据库表时报 __init__() missing 1 required positional argument: 'on_delete'
from django.db import models # Create your models here. class Category(models.Model): caption = mode ...
- Django问题 TypeError: __init__() missing 1 required positional argument: 'on_delete'
问题:在执行python manage.py makemigrations learning_logs时,系统会报错,提示:TypeError: __init__() missing 1 requir ...
- Python3:Django根据models生成数据库表时报 __init__() missing 1 required positional argument: 'on_delete'
Python3:Django根据models生成数据库表时报 __init__() missing 1 required positional argument: 'on_delete' 一.分析 在 ...
- Django2.1在根据models生成数据库表时报 __init__() missing 1 required positional argument: 'on_delete'
解决办法: a=models.ForeignKey('BookInfo',on_delete=models.CASCADE,) 即在外键值的后面加上 on_delete=models.CASCADE ...
随机推荐
- java 框架-分布式服务框架1ZooKeeper
https://www.cnblogs.com/felixzh/p/5869212.html Zookeeper的功能以及工作原理 1.ZooKeeper是什么?ZooKeeper是一个分布式的, ...
- tf 2.0
tf.function和Autograph使用指南-Part 1 "Keras之父发声:TF 2.0 + Keras 深度学习必知的12件事" Effective TensorFl ...
- flex 布局方式
开始啦 1. flex-direction 有关主轴的对齐方式 column 自上到下 row 自左到右 -->默认值 row-reverse 自右到左 column-reverse 自下到上 ...
- SpringCloud之Zuul网关原理及其配置
Zuul是spring cloud中的微服务网关.网关: 是一个网络整体系统中的前置门户入口.请求首先通过网关,进行路径的路由,定位到具体的服务节点上. Zuul是一个微服务网关,首先是一个微服务.也 ...
- MyBatis核心配置文件详析mybatis-cfg.xml
<?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE configuration PUBLIC & ...
- 负载均衡之haproxy负载均衡算法及haproxy的工作模式
haproxy负载均衡的算法有如下7种: .roundrobin : 基于权重轮循. static-rr : 基于权重轮循.静态算法,运行时改变无法生效 source : 基于请求源IP的算法.对请求 ...
- wakelock查看
Android的wakelock分为两层 待机异常https://wenku.baidu.com/view/6b765c8802020740be1e9bd8.html Linux层和应用层 查看Lin ...
- 《OAuth2.0协议安全形式化分析-》----论文摘抄整理
---恢复内容开始--- 本篇论文发表在计算机工程与设计,感觉写的还是很有水准的.实验部分交代的比较清楚 本篇论文的创新点: 使用Scyther工具 主要是在 DY模型下面 形式化分析了 OAuth2 ...
- java中的io流总结(二)——RandomAccessFile类
知识点:RandomAccessFile (随机访问文件)类 (一)描述 前一篇博客中https://www.cnblogs.com/shuaifing/p/11490160.html,主要描述Fil ...
- 机器学习中的数学-强大的矩阵奇异值分解(SVD)及其应用
版权声明: 本文由LeftNotEasy发布于http://leftnoteasy.cnblogs.com, 本文可以被全部的转载或者部分使用,但请注明出处,如果有问题,请联系wheeleast@gm ...