﻿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
1320	django.views.generic.create_update.delete_object does not  handle IntegrityError exception	mattimustang@…	Jacob	"
I'm getting the following exception thrown when I try and delete an object named 'My Company' that is set as the 'organisation' field for another object called 'My Contact'

Shouldn't delete_object handle this better?

{{{
IntegrityError at /directory/contacts/3/delete/
ERROR: update or delete on ""directory_contacts"" violates foreign key constraint ""directory_contacts_organisation_id_fkey"" on ""directory_contacts"" DETAIL: Key (id)=(3) is still referenced from table ""directory_contacts"". DELETE FROM ""directory_contacts"" WHERE ""id""=3
}}}

The model that I have is:
{{{
class Contact(meta.Model):
    name = meta.CharField(maxlenth=32)
    organisation = meta.ForeignKey('self', null=True, blank=True)

}}}
"	defect	closed	Generic views	dev	normal	duplicate			Design decision needed	0	0	0	0	0	0
