Opened 6 years ago

Closed 5 years ago

Last modified 5 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: UI/UX:

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 timo 5 years ago.

Download all attachments as: .zip

Change History (5)

comment:1 Changed 5 years ago by russellm

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

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.

Changed 5 years ago by timo

comment:2 Changed 5 years ago by anonymous

  • Has patch set

comment:3 Changed 5 years ago by timo

  • Resolution set to fixed
  • Status changed from new to closed

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

comment:4 Changed 5 years ago by timo

(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