I've come up with a solution to my own question below, but if anyone has
any better ideas, I'd love to hear them.
On 31/12/2010 12:45 AM, Timothy W. Grove wrote:
> Here are the bare-bones of two classes which are related through a
> many-to-many relationship:
>
> class SignEntry(SQLObject):
> components = RelatedJoin("Component")
>
> class Component(SQLObject):
> code = StringCol(default="", unique=True)
> sign_entries = RelatedJoin("SignEntry")
>
>
> With 'se' representing a particular 'SignEntry' object, the code
> 'se.components' reveals the internals of that object:
>
> [<Component 7 code='48'>, <Component 8 code='24'>, <Component 8
> code='24'>]
>
> Now, I wish to remove just one <Component 8 code='24'> from this
> object, but 'se.removeComponent(8)' removes both. Is there a (simple)
> way to achieve what I wish?
Well, I've thought of a 'simple' way to accomplish this, but I'm not
sure I'm altogether comfortable with it. First, I determine how many of
the same 'components' there are in the 'sign entry'. If there are more
than one, I delete them all and then add back in the others I want to
remain. That is a good enough solution for this year. Bring on 2011 !!!
>
> I'm using sqlobject-0.13.0-py2.7 on Windows 7.
>
> Thanks in advance for any advice.
>
> Best regards (and HAPPY NEW YEAR - ALMOST!),
> Tim Grove
>
>
>
> ------------------------------------------------------------------------------
> Learn how Oracle Real Application Clusters (RAC) One Node allows customers
> to consolidate database storage, standardize their database environment, and,
> should the need arise, upgrade to a full multi-node Oracle RAC database
> without downtime or disruption
> http://p.sf.net/sfu/oracle-sfdevnl
>
>
> _______________________________________________
> sqlobject-discuss mailing list
> sql...@li...
> https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss
|