From: Andy T. <an...@ha...> - 2005-05-10 10:55:31
|
Hi all, Excuse me being obtuse, but how do I select all of the child records for a specific parent in a 1:M foreign key relationship? E.g. given parent and child classes; class Parent(SQLObject): name = StringCol() children = MultipleJoin('Child') class Child(SQLObject): name = StringCol() parent = ForeignKey('Parent') How do I select all of the Child objects linked to the Parent with a name of 'Andy'? I've tried; >>> kids = Child.select(Parent.name == 'Andy') and >>> kids = Child.select(Child.q.parent.name == 'Andy') and various variations on that theme but haven't hit upon the one that works. Can anyone enlighten me. I'm using 0.6.1 if that makes any difference. Whilst I'm here, has anyone else had any trouble posting to this list from gmail? I had to subscribe and from this account because the two times I tried from gmail it got rejected. Thanks in advance, Andy -- -------------------------------------------------------------------------------- From the desk of Andrew J Todd esq - http://www.halfcooked.com/ |