>> > I assume you have a reason not to use:
>> >
>> > class x(SQLObject):
>> >     ys = ForeignKey( 'y' )
>>
>> Well, in the real life example I have the two objects 'x' and 'y' are
>> kinda like 'article' and 'tag'. A tag can be attached to several
>> articles and an article can have several tags attached to it.
>>
>> So I guess I have to use RelatedJoin on both.
>
>    A typical task for many-to-many relation.

Eventually I ended up doing this:

################################

class x(SQLObject):
    ys = RelatedJoin( 'x' )

class y(SQLObject):
    xs = RelatedJoin( 'y' )

myx = x.get( 1 )
myy = y.get( 1 )
if myx not in myy.xs:
    myy.addX( myx )

################################

Simple enough :)

Cheers,
Daniel

-- 
Psss, psss, put it down! - http://www.cafepress.com/putitdown

------------------------------------------------------------------------------
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most 
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to