On Dec 15, 2007, at 1:47 PM, Oleg Broytmann wrote:
> On Sat, Dec 15, 2007 at 01:18:08PM -0800, Fred C wrote:
>> I have two classes looking like shown bellow. I would like to know it
>> there is a way to access to the field status using SQLObjects methods
>> directly. (Without doing the joins my self).
>>
>> class Mbox(SQLObject):
>> class sqlmeta:
>> defaultOrder = "-created"
>> subject = UnicodeCol(length=512)
>> message = UnicodeCol()
>> created = DateTimeCol(default=datetime.now)
>> msg_from = ForeignKey('User', cascade=True)
>> msg_to = RelatedJoin("User", intermediateTable='mbox_user',
>> joinColumn='mbox_id',
>> otherColumn='user_id',
>> createRelatedTable=False)
>>
>>
>> class MboxUser(SQLObject):
>> class sqlmeta:
>> table = "mbox_user"
>> status = IntCol(default=0)
>> mbox = ForeignKey('Mbox', notNull=True, cascade=True)
>> user = ForeignKey('User', notNull=True, cascade=True)
>
> for user in message.msg_to:
> print user.status
>
> Is it what you want?
Yes something like that.
-fred-
-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss