问题
class DispatchAdmin(admin.ModelAdmin):
def delete_model(self, request, obj):
a.delete()
b.delete()
def save_model(self,request,obj,form,change):
x.save()
y.save()
________How can I________
how can I make the operation to the mysql database as a atomic operation by using the transaction? what should be "import",and if the action is failed, how to rollback?(notes:since I use django admin,there is no extra views.py)
来源:https://stackoverflow.com/questions/19003442/how-to-use-transaction-of-mysql-in-save-model-and-delete-model-of-django-adm