On Friday, February 6, 2015 at 2:28:44 AM UTC-5, Niphlod wrote:
>
> response.toolbar() holds a pretty nice view of what's lazy and what's not,
> so what's the issue ?
> The deal is ideally going throughout the whole model and NEVER see ANY
> db.tablename, i.e. like the part in red
>
> Field('productId', db.product, label='ProductId',
>
Though note that you can use db.tablename inside a function definition
(including a lambda function), as it will not be evaluated until the
function is actually called. So, you can do:
Field('productId', 'reference product', represent=lambda id, r: db.product(
id).name)
Also, if you have 155 tables, make sure you aren't defining all 155 on
every request (lazy or not). Instead, use conditional models or move the
table definitions to functions/classes within modules and import and define
only where needed.
Anthony
--
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.