Consider:

  db.define_table('person',
                         db.Field('uuid',length=64,default=uuid.uuid4
()),
                         db.Field
('modified_on','datetime',default=now),
                         db.Field('name'))
    db.define_table('dog',
                         db.Field('uuid',length=64,default=uuid.uuid4
()),
                         db.Field
('modified_on','datetime',default=now),
                         db.Field('owner',length=64),
                         db.Field('name'))
    db.dog.owner.requires=IS_IN_DB(db,'person.uuid','%(name)s')

you can do

db.dog.owner.display=lambda id: db(db.person.id==id).select()[0].name

and t2.displays(db.dog) will show you the owner's name not his id.

Massimo
On Dec 24, 5:56 am, Fran <[email protected]> wrote:
> On Dec 23, 6:39 pm, mdipierro <[email protected]> wrote:
>
> > db.table.exposed=[....]
> > you can set a list of fields that you want visible in T2.create/update
>
> db.table.exposes=[] does indeed work for t2.create() & t2.update() :)
> With db.table.displays for t2.display() & db.table.represent for
> t2.itemize(), this gives good control.
>
> However what is still missing is t2.display() being able to lookup on
> the other table from the UUID to a more meaningful field
> Like we have for t2.create() & t2.update() via:
> db.table.field.requires=IS_IN_DB(db,'table2.uuid','table2.name')
>
> F
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" 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