Opened 14 years ago
Closed 14 years ago
#14017 closed (fixed)
Wrong comment in django.contrib.admin.options log_deletion
Reported by: | Anssi Kääriäinen | Owned by: | nobody |
---|---|---|---|
Component: | contrib.admin | Version: | 1.2 |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Unreviewed | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Comment of django.contrib.admin.options log_deletion says:
Log that an object has been successfully deleted. Note that since the object is deleted, it might no longer be safe to call *any* methods on the object, hence this method getting object_repr.
However this function is called before the object is deleted (from admin.actions delete_selected() and admin.options delete_view().
The changeset that changed the order of obj.delete() and log_deletion() is r10686 fixing the issue reported in #10889. The reason for the change is that log_deletion needs the pk of the object, but this is set to none when obj.delete() is called.
The comment should probably mention that this function is called before deletion, as opposed to log_change and log_addition.
Attachments (1)
Change History (3)
by , 14 years ago
Attachment: | 14017.diff added |
---|
comment:1 by , 14 years ago
Has patch: | set |
---|
comment:2 by , 14 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
(In [14197]) Fixed #14017 -- wrong comment on log_deletion method of ModelAdmin
Also added a transaction around the deletion view to preserve DB state (and rollback the creation of LogEntry object in case the deletion fails)