Bug! This only works because address.user is named the same as the user table. If they have different names (address.user_id for example) it will fail. I think the 'referee' needs to be passed to DALRef.
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 -~----------~----~----~----~------~----~------~--~---

