This is what I was looking for....
Thanks Ross...

But the correct should be:

db.user.account = Field.Virtual(lambda row: row.user.account_id)


The Book seems to be wrong also:

db.item.total_price = Field.Virtual(lambda row: row.unit_price*row.quantity)

should be:

db.item.total_price = Field.Virtual(lambda row:
row.item.unit_price*row.item.quantity)



Thanks,
Marcello


On Tue, Jan 10, 2012 at 12:58 PM, Ross Peoples <[email protected]>wrote:

> You might be able to do something like this to trick it into being a
> virtual field:
>
> db.user.account = Field.Virtual(lambda row: row.account_id)
>
> This just makes a virtual field "account" which returns the value of 
> "account_id". This will only work with reads, though. If you try to set a 
> value to db.user.account, it will not work, you have to set it to 
> db.user.account_id.
>
>

Reply via email to