Skip to content

Commit

Permalink
Fixed #14017 -- wrong comment on log_deletion method of ModelAdmin
Browse files Browse the repository at this point in the history
Also added a transaction around the deletion view to preserve DB state (and rollback the creation of LogEntry object in case the deletion fails)

git-svn-id: http://code.djangoproject.com/svn/django/trunk@14197 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
honzakral committed Oct 13, 2010
1 parent 2c3b710 commit b7ed25a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions django/contrib/admin/options.py
Expand Up @@ -453,9 +453,8 @@ def log_change(self, request, object, message):


def log_deletion(self, request, object, object_repr): def log_deletion(self, request, object, object_repr):
""" """
Log that an object has been successfully deleted. Note that since the Log that an object will be deleted. Note that this method is called
object is deleted, it might no longer be safe to call *any* methods before the deletion.
on the object, hence this method getting object_repr.
The default implementation creates an admin LogEntry object. The default implementation creates an admin LogEntry object.
""" """
Expand Down Expand Up @@ -1097,6 +1096,7 @@ def changelist_view(self, request, extra_context=None):
], context, context_instance=context_instance) ], context, context_instance=context_instance)


@csrf_protect_m @csrf_protect_m
@transaction.commit_on_success
def delete_view(self, request, object_id, extra_context=None): def delete_view(self, request, object_id, extra_context=None):
"The 'delete' admin view for this model." "The 'delete' admin view for this model."
opts = self.model._meta opts = self.model._meta
Expand Down

0 comments on commit b7ed25a

Please sign in to comment.