Re: [SQLObject] third column in a MultipleJoin table
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Oleg B. <ph...@ph...> - 2006-12-13 21:35:53
|
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/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |