Opened 15 years ago

Closed 14 years ago

Last modified 14 years ago

#12313 closed (fixed)

Mention some cautions in section overriding delete()

Reported by: FunkyELF Owned by: nobody
Component: Documentation Version: 1.1
Severity: Keywords: delete admin signals
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I strongly feel that this section...

http://docs.djangoproject.com/en/dev/topics/db/models/#overriding-predefined-model-methods

... should have a note or something like the following.

Note that the delete() method for an object is not necessarily called when deleting a queryset containing that object as explained in http://docs.djangoproject.com/en/dev/topics/db/queries/#deleting-objects.
To ensure a customized delete method gets called have a look at http://docs.djangoproject.com/en/dev/topics/signals/#topics-signals
Also note that when deleting an object from the built in admin interface related objects may be deleted in this way and may not call the overridden delete() method.

Attachments (1)

12313.diff (795 bytes ) - added by Tim Graham 15 years ago.

Download all attachments as: .zip

Change History (5)

comment:1 by Russell Keith-Magee, 15 years ago

Triage Stage: UnreviewedAccepted

A note to this effect already exists in the queryset.delete() documentation (which you can get to if you follow the links from the "overriding model methods" page), but I agree it's worth repeating -- or at least drawing attention to the existing docs.

by Tim Graham, 15 years ago

Attachment: 12313.diff added

comment:2 by anonymous, 15 years ago

Has patch: set

comment:3 by Tim Graham, 14 years ago

Resolution: fixed
Status: newclosed

(In [15071]) Fixed #12313 - Add a note that QuerySet.delete() doesn't necessarily call obj.delete(). thanks FunkyELF for the suggestion.

comment:4 by Tim Graham, 14 years ago

(In [15072]) [1.2.X] Fixed #12313 - Add a note that QuerySet.delete() doesn't necessarily call obj.delete(). thanks FunkyELF for the suggestion.

Backport of r15071 from trunk.

Note: See TracTickets for help on using tickets.
Back to Top