id summary reporter owner description type status component version severity resolution keywords cc stage has_patch needs_docs needs_tests needs_better_patch easy ui_ux 19149 Generic Relation not cascading with Multi table inheritance. thomaspurchas "Generic Relations don't cascade on delete if you are using the generic relation of a superclass in a subclass, then deleting the subclass does not result in the normal cascade behaviour. For example using the following models: {{{#!python class TaggedItem(models.Model): tag = models.SlugField() content_type = models.ForeignKey(ContentType) object_id = models.PositiveIntegerField() content_object = generic.GenericForeignKey('content_type', 'object_id') def __unicode__(self): return self.tag class Post(models.Model): title = models.TextField(blank=True) relation = generic.GenericRelation(TaggedItem) def __unicode__(self): return self.title class ParentPost(Post): description = models.TextField(blank=True) def __unicode__(self): return self.description }}} If you create a `ParentPost` and a `TaggedItem` related using the GenericForeignKey: {{{#!python >>> p = ParentPost() >>> p.title = ""This is a title"" >>> p.description = ""This is a description"" >>> p.save() >>> t = TaggedItem(content_object=p, tag=""This is a tag"") >>> t.save() >>> TaggedItem.objects.all() [, ] }}} and then delete the `ParentPost`, the `TaggedItem` is not also deleted, rather it just points to a `None` object. {{{#!python >>> p.delete() >>> TaggedItem.objects.all() [, ] >>> print t.content_object None }}} If you repeat the same procedure with the `Post` model you get the expected behaviour where the `TaggedItem` is deleted." Bug new Database layer (models, ORM) dev Normal multitable, inheritance, genericforeignkey thomaspurchas michael@… michael@… sky.kok@… Accepted 1 0 0 1 0 0