|
From: Oleg B. <ph...@ph...> - 2004-04-22 14:47:06
|
Hello!
I need a MultipleJoin, where ForeignKey is the id of the same table.
I cannot do it directly, because I cannot redeclare id column, so I
implemented it the following way:
class Term(SQLObject):
translation = IntCol(default=None) # instead of MultipleJoin
def _get_translation(self):
_translation = self._SO_get_translation()
if _translation is None:
return None
return self.select(self.q.id == _translation, orderBy="code")
def _set_translation(self, codeObject):
if codeObject is not None:
codeObject = codeObject.id
self._SO_set_translation(codeObject)
_doc_translation = "ID of the parent code term for this code"
But this is ugly, and tiresome to reimplement every time I need such
a feature. How can I do it in a simpler way?
I am using SQLObject 0.5.2 with inheritance patch.
Oleg.
--
Oleg Broytmann http://phd.pp.ru/ ph...@ph...
Programmers don't die, they just GOSUB without RETURN.
|