On Fri, Mar 09, 2007 at 01:24:16PM +0100, [EMAIL PROTECTED] wrote: > # ---------------------------------- > class VoidFoo(sqlobject.SQLObject): > fooDooh = sqlobject.ForeignKey('Foo') > voidDooh = sqlobject.ForeignKey('Void') > > class Void(sqlobject.SQLObject): > foos = sqlobject.SQLRelatedJoin('Foo', intermediateTable = 'void_foo', > otherColumn = 'foo_dooh_id', createRelatedTable = False) > > class Foo(sqlobject.SQLObject): > voids = sqlobject.SQLRelatedJoin('Void', intermediateTable = > 'void_foo', otherColumn = 'void_dooh_id', createRelatedTable = False) > > Void.createTable() > Foo.createTable() > VoidFoo.createTable() > > foo = Foo() > foo.addVoid(Void()) > # ---------------------------------- > > 1/Query : INSERT INTO void_foo (foo_id, void_dooh_id) VALUES (1, 1) > > And that's the error I'm getting: > sqlobject.dberrors.OperationalError: Unknown column 'foo_id' in 'field > list' > > Apparently, the fooDoo isn't properly resolved to foo_doo_id but instead to > its default name foo_id. Is this a bug or am I just doing something wrong?
RelatedJoin cannot see "fooDooh" in VoidFoo definition. You have to help it to name the column using "joinColumn" keyword: class Void(sqlobject.SQLObject): foos = sqlobject.SQLRelatedJoin('Foo', intermediateTable = 'void_foo', joinColumn = 'void_dooh_id', otherColumn = 'foo_dooh_id', createRelatedTable = False) class Foo(sqlobject.SQLObject): voids = sqlobject.SQLRelatedJoin('Void', intermediateTable = 'void_foo', joinColumn = 'foo_dooh_id', otherColumn = 'void_dooh_id', createRelatedTable = False) Oleg. -- Oleg Broytmann http://phd.pp.ru/ [EMAIL PROTECTED] Programmers don't die, they just GOSUB without RETURN. ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ sqlobject-discuss mailing list sqlobject-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss