Oops. A typo. I fixed it in the previous message. On Wednesday, 9 October 2013 21:41:46 UTC-5, James Thompson wrote: > > I'm a little confused by: > >db.dog.owner.represent = None > >SQLFORM.grid(db.dog.represent==db.person.id) > > Why would we use db.dog.represent==db.person.id > rather than db.dog.owner==db.person.id > here? > > Thanks. > > > > > On Wednesday, October 9, 2013 3:20:08 PM UTC-10, Massimo Di Pierro wrote: >> >> It depends. It may. >> >> For example given: >> >> db.define_table('person',Field('name'),format='%(name)s') >> db.define_table('dog',Field('name'),Field('owner','reference dog')) >> >> if you do: >> >> SQLFORM.grid(db.dog.owner==db.person.id) >> >> it will do a recursive select for each row to find a representation of >> db.dog.owner. >> >> You can disabled this: >> >> db.dog.owner.represent = None >> SQLFORM.grid(db.dog.represent==db.person.id) >> >> or hide it >> >> db.dog.owner.readable = False >> SQLFORM.grid(db.dog.represent==db.person.id) >> >> or cache it: >> >> db.dog.owner.represent = lambda v,r: cache.ram('person-%s'%v, lambda v=v: >> v and '%(name)s'%db.person(v), None) >> SQLFORM.grid(db.dog.represent==db.person.id) >> >> You can always add the {{=response.toolbar()}} to see all the database >> queries. >> >> >> On Wednesday, 9 October 2013 14:39:07 UTC-5, James Thompson wrote: >>> >>> When using SQLTABLE (or something like: {{=query_results}}) to display >>> rows in a view, foreign key fields display data from their related table. >>> Is web2py doing individual queries for each of these fields? >>> >>> >>>
-- 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.