1👍
✅
You can set the on_delete
parameter of the ForeignKey
field to a value different than CASCADE
(the default value).
Ex:
type = models.ForeignKey(FoodType, null=True, on_delete=models.SET_NULL)
👤aumo
Source:stackexchange.com