hi,
is it possible to execute 2 function during update using sqlform.grid?
my goal is to combine e.g.1 with e.g.2 onupdate function.
for description :
in e.g.1 during update i want to update the others tables (room and
cleaning)
in e.g.2 during update i want to archive the previous value, so that i can
keep record the data changes
e.g. 1.
def __onupdate_booking(form):
room=db(db.room.id==form.vars.room).update(status='Booked')
cleaning=db(db.cleaning.room==form.vars.room).update(is_active=False)
return locals()
def booking():
query = db.booking.is_active==True
has_membership=auth.has_membership('Manager')
grid=SQLFORM.grid(query, user_signature=False,
maxtextlength=100,
onvalidation=__onvalidation_booking,
oncreate=__oncreate_booking,
onupdate=__onupdate_booking,
editable=has_membership, deletable=has_membership)
return locals()
e.g.2
def booking():
query = db.booking.is_active==True
has_membership=auth.has_membership('Manager')
grid=SQLFORM.grid(query, user_signature=False,
maxtextlength=100,
onvalidation=__onvalidation_booking,
oncreate=__oncreate_booking, onupdate=auth.archive,
editable=has_membership, deletable=has_membership)
return locals()
many thanks in advance
--
---
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.