When the referenced object is deleted, all objects that have
a foreign key to it will also be deleted.
For example, let's say we have an Author named "John" and two
books associated with him. If we delete the "John" Author object,
the two Book objects associated with "John" will also be
deleted automatically.
from django.db import models
class Author(models.Model):
name = models.CharField(max_length=100)
class Book(models.Model):
title = models.CharField(max_length=100)
author = models.ForeignKey(Author, on_delete=models.CASCADE)