Also in trunk now:

>>> max=db.user[1]
>>> max
>>> <DALStoarge {'name':'max'}>
>>> print max.id, max.name
1, max
>>> db.address.insert(user=max,city="Chicago")
>>> for row in db().select(db.address.ALL):
...     print row.user.name, row.city
...
max Chicago


On Oct 27, 1:09 pm, mdipierro <[email protected]> wrote:
> Give it a try. It is in trunk. Here is an example:
>
> $ python web2py.py -S mytest>>> db=DAL('sqlite://storage')
> >>> db.define_table('user',Field('name'))
> >>> db.define_table('address',Field('city'),Field('user',db.user))
> >>> db.user.insert(name="max")
> 1
> >>> db.address.insert(user=1,city="Chicago")
> 1
> >>> address=db.address[1]
> >>> print address.city
> Chicago
> >>> print address.user
> 1
> >>> print address.user.name
>
> max
>
> It works exactly as Mr Freeze proposed by:
> 1) it is backward compatible (I think)
> 2) it does not require adding any new keyword
> 3) the additional queries are lazy and cached so only executed when
> needed
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to