If you are updating a record, you should be able to retrieve the full
record via form.record:
def update_administer_volunteers(form):
# Email the decision to the proposer
volunteer = form.record.volunteer_id
# 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')
Note, form.record.volunteer_id is a Reference object, so you can do
recursive selects to retrieve the attributes of the volunteer (i.e.,
volunteer.email, volunteer.first_name, etc). Alternatively, you could use
your original query:
volunteer = db(db.auth_user.id == form.record.volunteer_id).select().first()
Anthony
--
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.