On 28-Nov-06, at 9:15 AM, Anton V. Belyaev wrote:

>
> Hello,
>
> Could you pleas explain, why MultipleJoin is needed in One-To-Many
> relationship?
>
> For example we have:
>
> class Element(SQLObject):
>     name = StringCol()
>     set = ForeignKey('Set')
>
> class Set(SQLObject):
>     set_name = StringCol()
>     elements = MultipleJoin('Element')
>
> I think ForeignKey is enought for One-To-Many:
> Set::elements can be done as list(Element.selectBy(test = test_id))

I believe it's so that it's bi-directional. So that you could do:

some_set.elements

and get all the elements that refer to this set. This is taken care  
of for
you automagically, so you only need to do either:

some_elm.set = some_set
or
some_set.addElement(some_elm)

and the other end will be taken care of.

Igor

--~--~---------~--~----~------------~-------~--~----~
 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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to