#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)
Change History (5)
comment:1 by , 16 years ago
| Triage Stage: | Unreviewed → Accepted |
|---|
by , 16 years ago
| Attachment: | 12313.diff added |
|---|
comment:2 by , 16 years ago
| Has patch: | set |
|---|
comment:3 by , 15 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
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.