1. 问题:TypeError: __init__() missing 1 required positional argument: 'on_delete'
class ForeignKey
(to, on_delete, **options)[source]¶
A many-to-one relationship. Requires two positional arguments: the class to which the model is related and the on_delete
option.
(on_delete
isn’t actually required, but not providing it gives a deprecation warning. It will be required in Django 2.0.)
To create a recursive relationship – an object that has a many-to-one relationship with itself
– use models.ForeignKey('self', on_delete=models.CASCADE)
.