  
  @python_2_unicode_compatible
  class Author2(models.Model):
      name = models.CharField(max_length=50, unique=True)
      first_book = models.ForeignKey('Book', related_name='first_time_authors+')
      favorite_books = models.ManyToManyField('Book', related_name='+')
  
      def __str__(self):
          return self.name
  
 
</s> remove     first_book = models.ForeignKey('Book', related_name='first_time_authors')
 </s> add     first_book = models.ForeignKey('Book', models.CASCADE, related_name='first_time_authors') </s> remove     greatest_fan = models.ForeignKey("Fan", null=True, unique=True)
 </s> add     greatest_fan = models.ForeignKey("Fan", models.SET_NULL, null=True, unique=True) </s> remove     poet = models.ForeignKey(Poet)
 </s> add     poet = models.ForeignKey(Poet, models.CASCADE) </s> remove     country = models.ForeignKey(Country)
 </s> add     country = models.ForeignKey(Country, models.CASCADE) </s> remove     restaurant = models.ForeignKey(Restaurant)
 </s> add     restaurant = models.ForeignKey(Restaurant, models.CASCADE)
    first_book = models.ForeignKey('Book', models.CASCADE, related_name='first_time_authors+')
  
  @python_2_unicode_compatible
  class Author2(models.Model):
      name = models.CharField(max_length=50, unique=True)
    first_book = models.ForeignKey('Book', models.CASCADE, related_name='first_time_authors+')
      favorite_books = models.ManyToManyField('Book', related_name='+')
  
      def __str__(self):
          return self.name
  
keep keep keep keep replace keep keep keep keep keep
 Fixed #21127 -- Started deprecation toward requiring on_delete for ForeignKey/OneToOneField 
tests/prefetch_related/models.py