On Sep 5, 11:33 pm, krsyoung <[EMAIL PROTECTED]> wrote:
> Hey,
>

> The search panel is focused around a Team object, but should allow the
> user to select Teams based on the Players or the content of the
> Messages.  I've gotten the Team and Message piece to work but how do I
> add in the Player piece as well?
>

I eventually got this working (I think).  The solution was based on a
post by Oleg Broytmann: http://www.mail-archive.com/[EMAIL 
PROTECTED]/msg02869.html

I'm still a little confused about how you actually reference the join
tables via the PlayerTeam.q syntax so I have manually defined the
following in my model.py:

class PlayerTeam(SQLObject):
    player = ForeignKey('Player)
    team = ForeignKey('Team')

And my filter looks like:

    if kwargs.get('playerName', None) != None:
         results = results.filter(IN(Team.q.id,
Select([PlayerTeam.q.TeamID], IN(PlayerTeam.q.playerID,
Select(Player.q.id, Player.q.name.contains(kwargs['playerName']))))))


99% sure it is wrong but it works!

-Chris
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to