Is it possible to use detect_record_change while submitting an edit with 
SQLFORM.grid. I'm talking the remotely possible but still possible case 
where two users choose to edit the same record simultaneously. Just the 
first one to submit her/his change should be successful. The second one 
should fail because the record has changed between record retrieval to 
populate edit form and the submission of changes. The Book gives code 
snippet to use SQLFORM (not .grid) but I do not know how to put a flash 
message where it says "# do something HERE FROM INSIDE A SQLFORM.grid?" 
because this code is managed by SQLFORM.grid, not by me as the case the 
Book shows.

def edit_dog():
    dog = db.dog(request.args(0)) or redirect(URL('error'))
    form=SQLFORM(db.dog,dog)
    form.process(detect_record_change=True)
    if form.record_changed:
        # do something HERE FROM INSIDE A SQLFORM.grid?
    elif form.accepted:
        # do something else
    else:
        # do nothing
    return dict(form=form)


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to