On Wed, Dec 13, 2006 at 03:56:15PM -0500, Dan Lenski wrote:
> How would I now find out the active roles, given a User instance?

   You can do it in Python:
user = User.get(id)
active_roles = [role for role in user.roles if role.active]
   The solution should be good enough because I don't expect there are too
many roles for a user.

   If you want to do this in SQL you have to do something like this:
roles = Role.select(Role.q.active==True && Role.q.user_id==user.id)

Oleg.
-- 
     Oleg Broytmann            http://phd.pp.ru/            [EMAIL PROTECTED]
           Programmers don't die, they just GOSUB without RETURN.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to