django.views.generic.create_update.delete_object does not handle IntegrityError exception
|Reported by:||mattimustang@…||Owned by:||jacob|
|Cc:||Triage Stage:||Design decision needed|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
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)
Change History (4)
comment:3 Changed 8 years ago by Gary Wilson <gary.wilson@…>
- Triage Stage changed from Unreviewed to Design decision needed