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 6818,"Generic Relations, doesn't seem to delete all related objects.",Niklas Collin,nobody,"Django doesn't seem to delete all related objects.[[BR]] Below: an owner has property has 2 resource.[[BR]] Deleting the owner will delete the property but not the resources[[BR]] {{{ #!python class Property(models.Model): owner = generic.GenericForeignKey() content_type = models.ForeignKey(ContentType) object_id = models.PositiveIntegerField() class Resource(models.Model): property = models.ForeignKey(Property, edit_inline=models.STACKED, num_in_admin=10) language_id = models.IntegerField(default=1, core=True) class Meta: unique_together = ((""property"", ""language_id""),) class AnExampleOwner(models.Model): properties = generic.GenericRelation(Property) }}} An example from the interpreter {{{ #!python In [2]: AnExampleOwner.objects.all().count() Out[2]: 0L In [3]: Property.objects.all().count() Out[3]: 0L In [4]: Resource.objects.all().count() Out[4]: 0L In [5]: o=AnExampleOwner() In [6]: o.save() In [7]: p=Property(owner = o) In [8]: p.save() In [9]: r=Resource(property=p, language_id = 1) In [10]: r.save() In [11]: r=Resource(property=p, language_id = 2) In [12]: r.save() In [13]: AnExampleOwner.objects.all().count() Out[13]: 1L In [14]: Property.objects.all().count() Out[14]: 1L In [15]: Resource.objects.all().count() Out[15]: 2L In [16]: o.delete() In [17]: AnExampleOwner.objects.all().count() Out[17]: 0L In [18]: Property.objects.all().count() Out[18]: 0L In [19]: Resource.objects.all().count() Out[19]: 2L }}}",Bug,closed,contrib.contenttypes,dev,Normal,duplicate,"GenericForeignRelation, deletion",niklas@…,Accepted,0,0,0,0,0,0