On Tuesday, April 8, 2014 2:44:52 PM UTC+2, 黄祥 wrote: > > hi, > > consider this : > # e.g. 1 work > for row in db(db.product).select(): > print row.rack.branch > # e.g. 2 not work > print db(db.product.rack.branch == 1).select() > > is it possible to have the example 2 work? >
no, you can't. db.table.field == something is something that can be passed to the underlying db. db.table.field.linked_table is something that web2py does recursively (yep, pretty bad) to pretty print what the database stores as records in separate tables linked by a FK. in your case, you'd need a simple join. e.g. db( (db.table.field == db.ref_table.id) & (db.ref_table.value == 'something') ).select(db.table.ALL) @Derek: that does exactly what "web2py's" prettyprint does. @all: do yourself a favour and start embracing moment.js ^__^ -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- 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 [email protected]. For more options, visit https://groups.google.com/d/optout.

