I almost never advise an Ajax solution first but this might be a reasonable 
way to go. This will work for 10s of rooms but probably not 100s since you 
have to click once to verify each room. You can choose whatever statuses you 
want. I have it so that it becomes "verified" when you click the link.

=== db.py ===
db.define_table('room',
    Field('name'), 
    Field('status'))

=== default.py ===
def index():
    rooms = db(db.room.id>0).select()
    return dict(rooms=rooms)

def update_status():
    room = db(db.room.id==request.vars.id).select().first()
    room.update_record(status='verified')
    return room.status

=== index.html ===
{{extend 'layout.html'}}
<form><input type="hidden" id="id" name="id" value="" /></form>
<ul>
{{for room in rooms:}}
    <li>{{=room.name}} - <a id="room{{=room.id}}" href='#' 
onclick="jQuery('#id').val('{{=room.id}}'); ajax('update_status', ['id'], 
'room{{=room.id}}');">{{=room.status}}</a></li>
{{pass}}
</ul>


Reply via email to