Switched the admin to use @transaction.atomic.

This commit is contained in:
Aymeric Augustin 2013-03-11 19:58:08 +01:00
parent 55a9be8ecf
commit 3710a918b2
2 changed files with 4 additions and 4 deletions

View File

@ -986,7 +986,7 @@ class ModelAdmin(BaseModelAdmin):
return None return None
@csrf_protect_m @csrf_protect_m
@transaction.commit_on_success @transaction.atomic
def add_view(self, request, form_url='', extra_context=None): def add_view(self, request, form_url='', extra_context=None):
"The 'add' admin view for this model." "The 'add' admin view for this model."
model = self.model model = self.model
@ -1073,7 +1073,7 @@ class ModelAdmin(BaseModelAdmin):
return self.render_change_form(request, context, form_url=form_url, add=True) return self.render_change_form(request, context, form_url=form_url, add=True)
@csrf_protect_m @csrf_protect_m
@transaction.commit_on_success @transaction.atomic
def change_view(self, request, object_id, form_url='', extra_context=None): def change_view(self, request, object_id, form_url='', extra_context=None):
"The 'change' admin view for this model." "The 'change' admin view for this model."
model = self.model model = self.model
@ -1318,7 +1318,7 @@ class ModelAdmin(BaseModelAdmin):
], context, current_app=self.admin_site.name) ], context, current_app=self.admin_site.name)
@csrf_protect_m @csrf_protect_m
@transaction.commit_on_success @transaction.atomic
def delete_view(self, request, object_id, extra_context=None): def delete_view(self, request, object_id, extra_context=None):
"The 'delete' admin view for this model." "The 'delete' admin view for this model."
opts = self.model._meta opts = self.model._meta

View File

@ -85,7 +85,7 @@ class UserAdmin(admin.ModelAdmin):
@sensitive_post_parameters() @sensitive_post_parameters()
@csrf_protect_m @csrf_protect_m
@transaction.commit_on_success @transaction.atomic
def add_view(self, request, form_url='', extra_context=None): def add_view(self, request, form_url='', extra_context=None):
# It's an error for a user to have add permission but NOT change # It's an error for a user to have add permission but NOT change
# permission for users. If we allowed such users to add users, they # permission for users. If we allowed such users to add users, they