first and foremost, you need to be able to have a Query that returns what 
you want. THEN, you can pass it to IS_IN_DB().

It's not so clear if the problem is you being unable to create such a Query 
or that you want a select to be dependant on a previous selection or if you 
have issues with IS_IN_DB()... 

On Saturday, August 6, 2016 at 9:00:00 AM UTC+2, stickman wrote:
>
> Hi all,
>
> I have a problem with coming up with a query for a dropdown list.
> I would like a list to only show the options that a user doesn't have.
>
> Scenario,
>
> auth_user 'bill' has auth_membership in 'user1' and 'user3'.
> If I want to add another auth_membership to 'bill', I would like only 
> 'user2' and 'user4' options to show up in the dropdown.
> I am using SQLFORM.factory for my form
>
>
> 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(db.auth_membership.user_id == id),'
> auth_group.id','%(role)s')),
>                                submit_button='Add New Membership')
>
> I hope that I am clear with my question.
> Thanks in advance
>

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