topic=models. ForeignKey (' topic 'on_delete=models. The CASCADE)
here's why:
Django after upgrading to 2.0, the correlation between table and table, must write on_delete parameters, otherwise you will quote exception:
TypeError: init () missing 1 required positional argument: 'on_delete
'
On_delete=None, associated # to delete the data in the table, the table associated with the field of the behavior of the
On_delete=models. CASCADE, # delete correlation data, and also delete
On_delete=models. DO_NOTHING, # delete correlation data, doing nothing
On_delete=models. PROTECT, # delete correlation data, error ProtectedError
# models. ForeignKey (' associative table, on_delete=models. SET_NULL, blank=True, null=True)
On_delete=models. SET_NULL, # delete correlation data, the value associated with set to null (premise fk1 - FK field needs to be set to null, one to one by the same token)
# models. ForeignKey (' associative table, on_delete=models. SET_DEFAULT, default='default')
On_delete=models. SET_DEFAULT, # delete correlation data, the value is set to default values associated with (premise fk1 - FK fields need to set a default value, one to one by the same token)
On_delete=models. SET # delete correlation data,
A. the value associated with SET to specify a value, SET up: models. The SET (value)
B. associated value is SET to the return values of executable object Settings: models. The SET (executable object)
Note: original articles by the author, for reprint please indicate the source,