Hey,

I'm polishing of a search panel for an application but I got stuck
trying to join on multiple tables.  The model is essentially:

class Team(SQLObject):
    subject = StringCol()
    player = RelatedJoin('Player')
    message = MultipleJoin('Message')

class Player(SQLObject):
    name = StringCol()
    team = RelatedJoin('Team')

class Message(SQLObject):
    body = StringCol()
    team = ForeignKey('Team')

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?

This is a snippet from the search controller function:
results = Team.select(join=[FULLJOINOn(Team, Message, Team.q.id ==
Message.q.teamID)])

if kwargs.get('message', None) != None:
    results =
results.filter(func.lower(Message.q.message).contains(func.lower(kwargs['message'])))


All ideas welcomed!
Thanks,
-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