db.dogs.owner_id.represent=lambda owner_id: db.users[owner_id].name

On Aug 14, 9:59 am, Carlos Aboim <abo...@gmail.com> wrote:
> Hi folks!
> I am here again as promised. (just kidding)
>
> I whould like to know how to access a cross reference model name.
> For example to clarify,
> I got:
>
> db.define_table('users',
>                 Field('name'),
>                 Field('email'))
>
> # ONE (users) TO MANY (dogs)
> db.define_table('dogs',
>                 Field('owner_id',db.users),
>                 Field('name'),
>                 Field('type'),
>                 Field('vaccinated','boolean',default=False),
>                 Field('picture','upload',default=''))
>
> And I want to render the 'owner' field of the 'dogs' table with the
> 'name' from 'users' table
> or better  dogs.owner = users.name
>
> I'm just getting the _id of that field (integer)
>
> Can I do this??
>
> Thank you
> Carlos Aboim
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to