diff options
| author | Brian Rosner <brosner@gmail.com> | 2008-02-29 21:39:13 +0000 |
|---|---|---|
| committer | Brian Rosner <brosner@gmail.com> | 2008-02-29 21:39:13 +0000 |
| commit | 61b9c8fe005d6d2a5a907b4402ce09b4b8153dad (patch) | |
| tree | 8585125bf13ccda5716496ac1cee8a89007941df /django | |
| parent | ea78533a288ecb2174ba83dff7654f06793dd8b9 (diff) | |
newforms-admin: Fixed #5735. Wrapped save_add and save_change with commit_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
Diffstat (limited to 'django')
| -rw-r--r-- | django/contrib/admin/options.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/django/contrib/admin/options.py b/django/contrib/admin/options.py index 3778995d7b..6c33b6e15e 100644 --- a/django/contrib/admin/options.py +++ b/django/contrib/admin/options.py @@ -5,7 +5,7 @@ from django.contrib.contenttypes.models import ContentType 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 @@ class ModelAdmin(BaseModelAdmin): else: 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 @@ class ModelAdmin(BaseModelAdmin): else: request.user.message_set.create(message=msg) 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 |
