Django在根据models生成数据库表时报 __init__() missing 1 required positional argument: 'on_delete'
model.py中:
class BlogArticles(models.Model):
title = models.CharField(max_length=300)
author = models.ForeignKey(User, related_name="blog_posts")
body = models.TextField()
publish = models.DateTimeField(default=timezone.now)
报错 :
D:\py\platform\platform\mysite>python manage.py makemigrations
Traceback (most recent call last):
File "manage.py", line 15, in <module>
execute_from_command_line(sys.argv)
File "D:\Program Files (x86)\Python\Python36\lib\site-packages
\django\core\management\__init__.py", line 381, in execute_from_
command_line
utility.execute()
。。。
File "D:\py\platform\platform\mysite\blog\models.py", line 9,
in <module>
class BlogArtic