首页 > 其他 > 详细

TypeError: __init__() missing 1 required positional argument: 'on_delete'

时间:2020-06-28 21:52:29      阅读:74      评论:0      收藏:0      [点我收藏+]

1.ForeignKey-->on_delete=models.CASCASE(or None,DO_NOTHING,PROTECT,SET_NULL,SET_DEFAULT,SET())

For Example:

 customer = models.ForeignKey("Customer",on_delete=models.CASCADE)

2.OneToOneField--ditto

user = models.OneToOneField(User,on_delete=models.CASCADE)

3.ManyToManyField-->Don‘t need!

TypeError: __init__() missing 1 required positional argument: 'on_delete'

原文:https://www.cnblogs.com/DotSDot/p/13204974.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!