﻿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
22594	Content Type framework does not trigger Cascade delete	JoseTomasTocino	nobody	"I've posted this question in StackOverflow (http://stackoverflow.com/questions/23528296/djangos-content-type-framework-does-not-trigger-cascade-delete) and given it looks like a bug, I've decided to post it here.

Suppose the following models:

{{{#!python
class DeltaCheck(models.Model):
    logs = generic.GenericRelation('Log')
    title = models.CharField(max_length=50)
    owner = models.ForeignKey(User)

class Log(models.Model):
    title = models.CharField(max_length=50)

    content_type = models.ForeignKey(ContentType)
    object_id = models.PositiveIntegerField()
    content_object = generic.GenericForeignKey('content_type', 'object_id')
}}}

If I create a DeltaCheck and a couple of Logs and then delete the DeltaCheck, the Logs are deleted as well:

{{{
In [7]: Log.objects.count()
Out[7]: 10

In [8]: DeltaCheck.objects.get().delete()

In [9]: Log.objects.count()
Out[9]: 0
}}}

BUT if I delete the User (the field owner), the DeltaCheck gets deleted BUT not the Logs, look:

{{{
In [14]: Log.objects.count()
Out[14]: 10

In [15]: DeltaCheck.objects.get().owner.delete()

In [16]: DeltaCheck.objects.all()
Out[16]: []

In [17]: Log.objects.count()
Out[17]: 10
}}}

Is that proper behavior? I don't think so."	Bug	closed	contrib.contenttypes	1.6	Normal	fixed		chk	Accepted	0	0	0	0	0	0
