From: Ian B. <ia...@co...> - 2004-04-22 16:20:01
|
Oleg Broytmann wrote: > On Thu, Apr 22, 2004 at 10:59:25AM -0500, Ian Bicking wrote: > >>Hmm... so this doesn't work? >> >>class Term(SQLObject): >> translation = ForeignKey('Term') > > > It is not what I want. > > The table must work (and is working now with my _get_ and _set_) the > following way: there is a term and a list of translations. Master term > can have or have not translations (aterm.translation is None). If there > are translations, they are terms from the same table, and for every > translation there is no a subtranslation: > > for t in aterm.translation: > if t.translation is not None: > raise TypeError > > Well, this is not enforced now, and it is not important to my > question. The question is - how to make translation MultipleJoin? I'd > like to declare > > class Term(SQLObject): > translation = MultipleJoin("Term") > > but there is no a ForeignKey for it. How can I declare id as the > ForeignKey? Hmm... okay (untested): class Term(SQLObject): translation = ForeignKey('Term') # This is definitely a separate idea from the above!: translatedTerms = MultipleJoin('Term', joinColumn='translation_id') I believe that will work, but I'm not sure. Ian |