I have this:
My form:
auth.settings.register_onaccept = lambda form: __add_user_membership(form)
auth.settings.register_next = URL('members', 'ingeschreven')
return dict(form=auth.register())
My onaccept function:
def __add_user_membership(form):
user_id = form.vars.id
if form.vars.is_company==True:
print "Adding user to the company group"
group=db(db.auth_group.role=='company').select().first()
auth.add_membership(group.id,user_id)
else:
print "Company was not selected"
if form.vars.is_client==True:
print "Adding user to the client group"
group=db(db.auth_group.role=='client').select().first()
auth.add_membership(group.id,user_id)
else:
print "Client was not selected"
if form.vars.is_reseller==True:
print "Adding user to the reseller group"
group=db(db.auth_group.role=='reseller').select().first()
auth.add_membership(group.id,user_id)
else:
print "Company was not selected"
if form.vars.is_supplier==True:
print "Adding user to the supplier group"
group=db(db.auth_group.role=='supplier').select().first()
auth.add_membership(group.id,user_id)
else:
print "Client was not selected"
When I fill out the form and submit, the user is not added and nothing
happens..
--
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.