Django在根据models生成数据库表时报 __init__() missing 1 required positional argument: 'on_delete'
code:
#encoding=utf-8 from django.db import models #Create your models here. class BookInfo(models.Model): #创建书本信息类,继承models.Model booktitle=models.CharField(max_length=20) bookdata=models.DateField() class HeroInfo(models.Model): #创建英雄信息类 heroname=models.CharField(max_length=10) herosex models.BooleanField() herocontent=models.CharField(max_length=50) herobook=models.ForeignKey(BookInfo) #引用外键,即BookInfo对象