def handle_exception(self, *args, **kwargs):
"""Handle exception with transaction rollback."""
response = super(AtomicMixin, self).handle_exception(*args, **kwargs)
if getattr(response, 'exception'):
# We've suppressed the exception but still need to rollback any transaction.
transaction.set_rollback(True)
return response
评论列表
文章目录