  class GenericRelationshipTests(IsolatedModelsTestCase):
  
      def test_valid_generic_relationship(self):
          class TaggedItem(models.Model):
              content_type = models.ForeignKey(ContentType)
              object_id = models.PositiveIntegerField()
              content_object = GenericForeignKey()
  
          class Bookmark(models.Model):
              tags = GenericRelation('TaggedItem')
 
</s> remove             content_type = models.ForeignKey(ContentType)
 </s> add             content_type = models.ForeignKey(ContentType, models.CASCADE) </s> remove             content_type = models.ForeignKey(ContentType)
 </s> add             content_type = models.ForeignKey(ContentType, models.CASCADE) </s> remove     content_type = models.ForeignKey(ContentType)
 </s> add     content_type = models.ForeignKey(ContentType, models.CASCADE) </s> remove             content_type = models.ForeignKey(ContentType)
 </s> add             content_type = models.ForeignKey(ContentType, models.CASCADE) </s> remove             custom_content_type = models.ForeignKey(ContentType)
 </s> add             custom_content_type = models.ForeignKey(ContentType, models.CASCADE)
            content_type = models.ForeignKey(ContentType, models.CASCADE)
  class GenericRelationshipTests(IsolatedModelsTestCase):
  
      def test_valid_generic_relationship(self):
          class TaggedItem(models.Model):
            content_type = models.ForeignKey(ContentType, models.CASCADE)
              object_id = models.PositiveIntegerField()
              content_object = GenericForeignKey()
  
          class Bookmark(models.Model):
              tags = GenericRelation('TaggedItem')
keep keep keep keep replace keep keep keep keep keep
 Fixed #21127 -- Started deprecation toward requiring on_delete for ForeignKey/OneToOneField 
tests/contenttypes_tests/tests.py