check_in = db.check_in[id] print check_in.room.category.price
On Wednesday, 10 April 2013 04:38:08 UTC-5, 黄祥 wrote: > > hi folks, > > i want to get the value of table row that have 3 nested values. my goal is > to get the price value from table room_category from function check_out in > my controller. how to do this in web2py efficient way? > > e.g. > db.define_table('room_category', > Field('category'), > * Field('price', 'decimal(10,2)'),* > format='%(category)s') > > db.define_table('room', > Field('room_no'), > Field('category', 'reference room_category'), > Field('status'), > Field('branch', 'reference branch'), > format=lambda r: '%s-%s' % (r.branch.address, r.room_no)) > > db.define_table('check_in', > Field('is_booking', 'boolean'), > Field('booking', 'reference booking'), > Field('room', 'reference room'), > Field('guest', 'reference guest'), > Field('description', 'text'), > format='%(description)s') > > db.define_table('check_out', > Field('check_in', 'reference check_in'), > Field('room', 'reference room'), > Field('guest', 'reference guest'), > Field('description', 'text'), > Field('duration'), > format='%(guest)s %(room)s') > > thank you so much in advance > > -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.