@auth.requires_membership('admin')
def block_access():
    """
    UPDATE auth_user
    SET registration_key='blocked'
    WHERE auth_user.registration_key = ''
      AND auth_user.email <> 'adminEmail'
    """
    db((db.auth_user.registration_key == '') & (db.auth_user.email !=
'adminEmail')).update(registration_key='blocked')
    db.commit()

And then in the view, I use this code :
<div class="dashboard_admin_widget">
<h2>{{=T('administration').capitalize()}}</h2>
<br>
{{=T('access').capitalize()}}
    <ul>
        <li>
            <button onclick="ajax('block_access',[],null);">
                {{=T('block access').capitalize()}}
            </button>
        </li>
        <li>
            <button onclick="ajax('unblock_access',[],null);">
                {{=T('unblock access').capitalize()}}
            </button>
        </li>
    </ul>

</div>

Richard

On Wed, Jul 4, 2012 at 5:10 PM, BlueShadow <[email protected]> wrote:

> I like to execute one line of python code when a link is clicked.
> Something like go to page index and change variable x to y.
> Is there a way to do this other than sending arguments to the controller?
>

Reply via email to