Author: Honza_Kral
Date: 2010-10-12 23:16:31 -0500 (Tue, 12 Oct 2010)
New Revision: 14197

Modified:
   django/trunk/django/contrib/admin/options.py
Log:
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)

Modified: django/trunk/django/contrib/admin/options.py
===================================================================
--- django/trunk/django/contrib/admin/options.py        2010-10-13 01:25:04 UTC 
(rev 14196)
+++ django/trunk/django/contrib/admin/options.py        2010-10-13 04:16:31 UTC 
(rev 14197)
@@ -453,9 +453,8 @@
 
     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 @@
         ], 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

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to