I think this helps, it's sample working code for my Article model. 
Articles have related articles:

class Article(SQLObject):
     title = UnicodeCol()
     body = UnicodeCol()
     created = DateTimeCol(default=datetime.now)
     sort = IntCol(default=0)

     slug = StringCol(alternateID=True, default=None, length=255)
     subject = ForeignKey("Subject")
     user = ForeignKey("User")
     related = RelatedJoin("Article", joinColumn="related_id_1",
         otherColumn="related_id_2", orderBy="title")

     def _set_title(self, value):
         if not self.slug:
             self.slug = Slug(value, self)
         self._SO_set_title(value)
     def _get_siteurl(self):
         return "/information/%s/%s.html" % (self.subject.slug,
             self.slug)
     def __str__(self):
         return self.title

I had to manually create the join table after `sql create` - no other 
caveats.

-Rob

Jorge Godoy wrote:
> Em Terça 16 Maio 2006 19:18, Ed Singleton escreveu:
>> I want to join a table with itself in the model definition.
>>
>> Something like:
>>
>> class Page(SQLObject):
>>     parent_page = ForeignKey('Page')
>>     child_pages = MultipleJoin('Page')
>>
>> but when I do, and I try to pull out the child pages I get the error:
>>
>> OperationalError: (1054, "Unknown column 'page_id' in 'where clause'")
>>
>> Any clues?
> 
> Specify the "joinColumn" as "id".  
> 

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