commit c81db5885f0a22140fefa34442bd0a3d648f3a58
Author: Honza Král <Honza.Kral@gmail.com>
Date: Thu Oct 11 13:04:28 2007 +0200
Wrapped admin.save_add and admin.save_change into a transaction
diff --git a/django/contrib/admin/options.py b/django/contrib/admin/options.py
index 76c6bf1..0365228 100644
a
|
b
|
from django.contrib.contenttypes.models import ContentType
|
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 |
… |
… |
class ModelAdmin(BaseModelAdmin):
|
399 | 399 | else: |
400 | 400 | post_url = '../../../' |
401 | 401 | return HttpResponseRedirect(post_url) |
| 402 | save_add = transaction.commit_on_success( save_add ) |
402 | 403 | |
403 | 404 | def save_change(self, request, model, form, formsets=None): |
404 | 405 | """ |
… |
… |
class ModelAdmin(BaseModelAdmin):
|
449 | 450 | else: |
450 | 451 | request.user.message_set.create(message=msg) |
451 | 452 | return HttpResponseRedirect("../") |
| 453 | save_change = transaction.commit_on_success( save_change ) |
452 | 454 | |
453 | 455 | def render_change_form(self, model, context, add=False, change=False, form_url=''): |
454 | 456 | opts = model._meta |