Skip to content
Browse files

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: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
1 parent ea78533 commit 61b9c8fe005d6d2a5a907b4402ce09b4b8153dad @brosner brosner committed
Showing with 3 additions and 1 deletion.
  1. +3 −1 django/contrib/admin/
4 django/contrib/admin/
@@ -5,7 +5,7 @@
from django.contrib.admin import widgets
from django.contrib.admin.util import get_deleted_objects
from django.core.exceptions import ImproperlyConfigured, PermissionDenied
-from django.db import models
+from django.db import models, transaction
from django.http import Http404, HttpResponse, HttpResponseRedirect
from django.shortcuts import get_object_or_404, render_to_response
from django.utils.html import escape
@@ -401,6 +401,7 @@ def save_add(self, request, model, form, formsets, post_url_continue):
post_url = '../../../'
return HttpResponseRedirect(post_url)
+ save_add = transaction.commit_on_success(save_add)
def save_change(self, request, model, form, formsets=None):
@@ -451,6 +452,7 @@ def save_change(self, request, model, form, formsets=None):
return HttpResponseRedirect("../")
+ save_change = transaction.commit_on_success(save_change)
def render_change_form(self, request, model, context, add=False, change=False, form_url='', obj=None):
opts = model._meta

0 comments on commit 61b9c8f

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