I am probably going about this all wrong, so I am open to suggestions.
However I am wondering how I can append a user (if approved) to a table
row. Currently I have a project_groups table and a tmp table as you can see
below. The tmp table is meant as a place holder for users requesting access
to the group. The access is granted if a user sends a request and the
project admin approves the request using ajax/javascript. However I am
having problems in passing these values from the tmp table and updating the
project_groups.members field. Any advice would be greatly appreciated.
db.define_table('project_groups',
....
Field('members', requires=IS_IN_DB(db, db.auth_user, '%(first_name)s
%(last_name)s %(public_email)s', multiple=(1, 1000)), default=auth.user_id,
writable=False, readable=False),
...
db.define_table('tmp',
Field('source', db.auth_user, default=auth.user_id, writable=False,
readable=False),
Field('project_groups', db.project_groups, default=auth.user_id,
writable=False, readable=False),
Field('created_on', 'datetime', default=request.now, writable=False,
readable=False))
# The query which is baffling me at this stage
elif request.args(0) == 'accept':
#tmp = db((db.tmp.project_groups == db.project_groups.id) &
(db.project_groups.userinfo == auth.user_id)).select()
tmp_user = request.args(1)
tmp = db(db.tmp.source == tmp_user).select(db.tmp.ALL)
updates = db(db.project_groups.id ==
db.tmp.project_groups).select(db.project_groups.ALL)
for myupdate in updates:
myupdate.update(members = myupdate.members + [tmp_user])
#db(db.tmp.source == a0).delete()
return
Thanks if anyone out there can help.
--
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/groups/opt_out.