'Rolls back the database and leaves transaction management'

def process_exception(self, request, exception):

    if transaction.is_dirty():
        transaction.rollback()
    transaction.leave_transaction_management()
