      class Author(models.Model):
          name = models.CharField(max_length=100)
  
      class Book(models.Model):
          author = models.ForeignKey(Author)
          title = models.CharField(max_length=100)
  
  If you want to create a formset that allows you to edit books belonging to
  a particular author, you could do this::
  
 
</s> remove         author = models.ForeignKey(Person)
 </s> add         author = models.ForeignKey(Person, on_delete=models.CASCADE) </s> remove         person = models.ForeignKey(Person)
        group = models.ForeignKey(Group)
 </s> add         person = models.ForeignKey(Person, on_delete=models.CASCADE)
        group = models.ForeignKey(Group, on_delete=models.CASCADE) </s> remove     reporter = models.ForeignKey(ProxyTrackerUser)
    associated_bug = models.ForeignKey(ProxyProxyBug)
 </s> add     reporter = models.ForeignKey(ProxyTrackerUser, models.CASCADE)
    associated_bug = models.ForeignKey(ProxyProxyBug, models.CASCADE) </s> remove         kind = models.ForeignKey(ThingKind, related_name='kinds',
                                 verbose_name=_('kind'))
 </s> add         kind = models.ForeignKey(
            ThingKind,
            on_delete=models.CASCADE,
            related_name='kinds',
            verbose_name=_('kind'),
        ) </s> remove         author = models.ForeignKey(Person)
 </s> add         author = models.ForeignKey(Person, on_delete=models.CASCADE)
        author = models.ForeignKey(Author, on_delete=models.CASCADE)
      class Author(models.Model):
          name = models.CharField(max_length=100)
  
      class Book(models.Model):
        author = models.ForeignKey(Author, on_delete=models.CASCADE)
          title = models.CharField(max_length=100)
  
  If you want to create a formset that allows you to edit books belonging to
  a particular author, you could do this::
  
keep keep keep keep replace keep keep keep keep keep
 Fixed #21127 -- Started deprecation toward requiring on_delete for ForeignKey/OneToOneField 
docs/topics/forms/modelforms.txt