> I have two classes:
>
> class Team(SQLObject):
>     name = StringCol(length=30)

Since you have "thisTeam" in Game as a ForeignKey to Team, it seems
like each Team has (or is related to) multiple games. So you should
add a join attribute to Team:

    games = MultipleJoin('Game')

> class Game(SQLObject):
>     thisTeam = ForeignKey("Team")
>     otherTeam = StringCol(length=30)
>     gameDate = DateCol()
>
> What I want to do is delete all the games for a team, from a method
> defined in the Team class, sort of like this:
>
> class Team(SQLObject):
>     name = StringCol(length=30)
>
>     def deleteGames(self):
>           sqlbuilder.Delete(Game, where=(Game.q.thisTeamID == self.id))

With the join attribute you can write:

    def deleteGames(self):
        for game in self.games:
            game.destroySelf()

--
mvh Björn

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to