Hi:

I'd like to do the following, but don't know the right way to do it:

u = User.get(59)
c = Contacts.select()
c = c.filter(Contact.q.districtID.in(district.id for district in 
u.districts))

The part here that doesn't work is the 'in' method on the 
Contact.q.districtID.  What I'm trying to accomplish is to get a list of 
Contacts that are in the Districts that this User can access.  I think 
this is fairly straight-forward, but please let me know if I need 
further clarification of what I'm trying to do.

Is there a way to filter the select results by the values in a list?

    -Jim

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to