  
  @python_2_unicode_compatible
  class Employee(models.Model):
      name = models.CharField(max_length=50)
      boss = models.ForeignKey('self', null=True,
                               related_name='serfs')
  
      def __str__(self):
          return self.name
  
      class Meta:
 
</s> remove     department = models.ForeignKey(Department, to_field="code")
 </s> add     department = models.ForeignKey(Department, models.CASCADE, to_field="code") </s> remove     related = models.ForeignKey(Secondary)
 </s> add     related = models.ForeignKey(Secondary, models.CASCADE) </s> remove     parent = models.ForeignKey('self', null=True, blank=True, related_name='children')
 </s> add     parent = models.ForeignKey('self', models.SET_NULL, null=True, blank=True, related_name='children') </s> remove     parent = models.ForeignKey('self', blank=True, null=True,
            related_name='children')
    category = models.ForeignKey(NamedCategory, null=True, default=None)
 </s> add     parent = models.ForeignKey(
        'self',
        models.SET_NULL,
        blank=True, null=True,
        related_name='children',
    )
    category = models.ForeignKey(NamedCategory, models.SET_NULL, null=True, default=None) </s> remove     restaurant = models.ForeignKey(Restaurant)
 </s> add     restaurant = models.ForeignKey(Restaurant, models.CASCADE)
    boss = models.ForeignKey('self', models.SET_NULL, null=True, related_name='serfs')
  
  @python_2_unicode_compatible
  class Employee(models.Model):
      name = models.CharField(max_length=50)
    boss = models.ForeignKey('self', models.SET_NULL, null=True, related_name='serfs')
    boss = models.ForeignKey('self', models.SET_NULL, null=True, related_name='serfs')
  
      def __str__(self):
          return self.name
  
      class Meta:
keep keep keep keep replace replace keep keep keep keep keep
 Fixed #21127 -- Started deprecation toward requiring on_delete for ForeignKey/OneToOneField 
tests/prefetch_related/models.py