diff options
| author | Honza Král <honza.kral@gmail.com> | 2010-10-13 04:16:31 +0000 |
|---|---|---|
| committer | Honza Král <honza.kral@gmail.com> | 2010-10-13 04:16:31 +0000 |
| commit | b7ed25a0f3c02b2326a6256243f66acaf4986530 (patch) | |
| tree | edb882f0db6acf61926b767c76035408800b746d | |
| parent | 2c3b710d0aebc4e349c8f834d2eb76573b608ce9 (diff) | |
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)
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14197 bcc190cf-cafb-0310-a4f2-bffc1f526a37
| -rw-r--r-- | django/contrib/admin/options.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/django/contrib/admin/options.py b/django/contrib/admin/options.py index ba89bae6d2..12490c88d2 100644 --- a/django/contrib/admin/options.py +++ b/django/contrib/admin/options.py @@ -453,9 +453,8 @@ class ModelAdmin(BaseModelAdmin): def log_deletion(self, request, object, object_repr): """ - 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. + Log that an object will be deleted. Note that this method is called + before the deletion. The default implementation creates an admin LogEntry object. """ @@ -1097,6 +1096,7 @@ class ModelAdmin(BaseModelAdmin): ], context, context_instance=context_instance) @csrf_protect_m + @transaction.commit_on_success def delete_view(self, request, object_id, extra_context=None): "The 'delete' admin view for this model." opts = self.model._meta |
