python编程从入门到实践
第19章19.3.2将数据关联到用户
models.py原文代码:
owner = models.ForeignKey(User)
执行django shell对话时出现如下错误:
owner = models.ForeignKey(User)
TypeError: init() missing 1 required positional argument: ‘on_delete’
修改如下:
owner = models.ForeignKey(User, on_delete=models.CASCADE)