﻿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
17140	Unexpected behaviour with on_delete handlers and proxy models (IntegrityError)	Jaap Roes	nobody	"Let's say I have a `File` model and an `Image` model. The second one being a proxy to the File model, with some additional methods and a manager that only return image-like files.

Another model has a `ForeignKey` to the `Image` model. Deleting an `Image` will trigger the `on_delete` handlers of it's foreign keys, cascades happen and everything is fine.

Deleting the same thing as an instance of `File` however will not clean up every objects linking to it. Instead an `IntegrityError` is raised. It's obvious that the `File` doesn't know it's also an `Image` and therefore doesn't trigger the `on_delete` handler of foreign keys referring to it by a different name.

I don't really see a nice way to work around or fix this problem. 
"	Bug	closed	Database layer (models, ORM)	1.3	Normal	duplicate	ForeignKey on_delete proxy model IntegrityError CASCADE SET_NULL		Accepted	0	0	0	0	0	0
