Thanks Massimo,

I actually finally figured out a query that works.
I still consider myself a newbee with web2py.

Here is my code:

memberships = db(db.auth_membership.user_id == 
id).select(db.auth_membership.group_id)
        temp = []
        for each in range(len(memberships)):
            temp.append(int(memberships[each]['group_id']))
        query = ~db.auth_group.id.belongs(temp)

        form = SQLFORM.factory(Field('user_id', 
requires=IS_IN_DB(db(db.auth_user.id == id), 'auth_user.id', 
'%(username)s',zero=None)),
                               
Field('group_id',requires=IS_IN_DB(db(query),'auth_group.id','%(role)s')),
                               submit_button='Add New Membership'

The dropdown now only has the membership that the current user doesn't 
already have.
Just wondering if there is a simpler way of doing this??

 

-- 
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.

Reply via email to