Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

newforms-admin: Fixed #5735. Wrapped save_add and save_change with co…

…mmit_on_success to ensure data consistency if an inline fails to save. Thanks, Honza Kral.

git-svn-id: http://code.djangoproject.com/svn/django/branches/newforms-admin@7188 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 61b9c8fe005d6d2a5a907b4402ce09b4b8153dad 1 parent ea78533
Brian Rosner authored February 29, 2008

Showing 1 changed file with 3 additions and 1 deletion. Show diff stats Hide diff stats

  1. 4  django/contrib/admin/options.py
4  django/contrib/admin/options.py
@@ -5,7 +5,7 @@
5 5
 from django.contrib.admin import widgets
6 6
 from django.contrib.admin.util import get_deleted_objects
7 7
 from django.core.exceptions import ImproperlyConfigured, PermissionDenied
8  
-from django.db import models
  8
+from django.db import models, transaction
9 9
 from django.http import Http404, HttpResponse, HttpResponseRedirect
10 10
 from django.shortcuts import get_object_or_404, render_to_response
11 11
 from django.utils.html import escape
@@ -401,6 +401,7 @@ def save_add(self, request, model, form, formsets, post_url_continue):
401 401
             else:
402 402
                 post_url = '../../../'
403 403
             return HttpResponseRedirect(post_url)
  404
+    save_add = transaction.commit_on_success(save_add)
404 405
 
405 406
     def save_change(self, request, model, form, formsets=None):
406 407
         """
@@ -451,6 +452,7 @@ def save_change(self, request, model, form, formsets=None):
451 452
         else:
452 453
             request.user.message_set.create(message=msg)
453 454
             return HttpResponseRedirect("../")
  455
+    save_change = transaction.commit_on_success(save_change)
454 456
 
455 457
     def render_change_form(self, request, model, context, add=False, change=False, form_url='', obj=None):
456 458
         opts = model._meta

0 notes on commit 61b9c8f

Please sign in to comment.
Something went wrong with that request. Please try again.