'Commits and leaves transaction management.'

def process_response(self, request, response):

    if transaction.is_managed():
        if transaction.is_dirty():
            transaction.commit()
        transaction.leave_transaction_management()
    return response
