what happens when we use "on_delete=models.CASCADE" in django models
class HospitalStay(models.Model):
patient = models.ForeignKey(User, on_delete = models.CASCADE)
what happens when we use "on_delete=models.CASCADE" in django models
class HospitalStay(models.Model):
patient = models.ForeignKey(User, on_delete = models.CASCADE)
CASCADE means that the row will be deleted too if the ForeignKey gets deleted.
In your case, HospitalStay instance will be deleted if the User Linked to it gets deleted.