Hello all,
Thanks for the information and help.
- I can see that using SQLFORM simplifies it, but the SQLFORM.grid API
makes it really easy to present a user with a summary table of options that
they can then click into to see details.
- The other options suggested both carry out the query I was trying to
avoid (getting the volunteer_id from the help_offered table), so it makes
more sense to me to put that directly into the onvalidate function.
I guess I had the intuition that the volunteer_id value was lurking
somewhere in the form API (it is shown on screen!) so that I could just
retrieve it rather than submitting a query to the DAL, but that may not be
the overhead I think it is!
So, this now works as an onvalidate function:
def update_administer_volunteers(form):
# Email the decision to the proposer
vol_id = db.help_offered(form.vars.id).volunteer_id
row = db(db.auth_user.id == vol_id).select().first()
volunteer_email = row.email
volunteer_fn = row.first_name
# alternatives
if form.vars.admin_status == 'Approved':
mail.send(to=volunteer_email,
subject='Decision',
message='Approved'
elif form.vars.admin_status == 'Rejected':
mail.send(to=volunteer_email,
subject='Decision',
message='Rejected')
else:
pass
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.