Thanks, That works! среда, 12 сентября 2012 г., 23:24:01 UTC+7 пользователь Massimo Di Pierro написал: > > I think it should be > > db.item.total_price = Field.Virtual(lambda row: row.item.unit_price*row > .item.quantity) > > This was an experimental feature and it may be wrong in the book. > > > On Wednesday, 12 September 2012 11:21:10 UTC-5, KMax wrote: >> >> >> Hello, >> I was looking the book http://www.web2py.com/books/default/chapter/29/06 >> And intrested with: >> >> New style virtual fields (experimental) >> >> >> Create model.db with: >> >> db.define_table('item', >> Field('unit_price','double'), >> Field('quantity','integer')) >> db.item.total_price = Field.Virtual(lambda row: row.unit_price*row.quantity) >> >> Open database admin and insert some numbers >> but the table view gives only flash with: >> >> 'Row' object has no attribute 'unit_price' >> >> and no data. >> >> Please correct my mistake, >> I think I missed something. >> >> Thanks, >> Maxim >> >
--