Hi,

It wasn't clear to me from the ticket that related join tables were
not being created at all. This has got to be a bug, because SQLObject
docs imply that the intermediate table is created for you without
further input:

http://sqlobject.org/SQLObject.html#many-to-many-relationships

I'm not going to hold up 0.9a3 for this, but it is important to fix.

Kevin

On 4/3/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> So I figured this one out, posting my solution so that anyone else who
> runs into might be able to solve it more quickly than I. Basically,
> with the "related join" you need to add the extra definitions that
> SQLObject is expecting. Thus, a model that looks like this:
>
> class Item(SQLObject):
>         name = StringCol(alternateID = True)
>         description = StringCol()
>         link = StringCol()
>         categories = RelatedJoin('Category')
>
> class Category(SQLObject):
>         name = StringCol(alternateID = True)
>         items = RelatedJoin('Item')
>
> Needs to be changed so that it looks something like this instead:
>
> class Item(SQLObject):
>         name = StringCol(alternateID = True)
>         description = StringCol()
>         link = StringCol()
>         categories = RelatedJoin('Category',
> intermediateTable="category_join",
>                          joinColumn="item_id",
> otherColumn="category_id")
>
> class Category(SQLObject):
>         name = StringCol(alternateID = True)
>         items = RelatedJoin('Item', intermediateTable="category_join",
>                          joinColumn="category_id", otherColumn="id")
>
>
> Then it will work correctly. The tutorials (20 minute wiki and
> turbotunes) don't have their models built this way. I discovered this
> after looking at the SQLObject documention and looking at the code for
> fasttrack.
>
> -QH-
>
>
> >
>


--
Kevin Dangoor
Author of the Zesty News RSS newsreader

email: [EMAIL PROTECTED]
company: http://www.BlazingThings.com
blog: http://www.BlueSkyOnMars.com

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