mirror of
https://github.com/django/django.git
synced 2025-07-04 01:39:20 +00:00
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
This commit is contained in:
parent
ea78533a28
commit
61b9c8fe00
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user