Yes you can do it with a bit of extra work:

db.define_table('person',Field('name'))
db.define_table('dog',Field('name'),Field('owner',db.person))
db.define_table('walk',Field('dog',db.dog),Field('when','datetime'))

db.dog.owner.requires = IS_IN_DB(db,'person.id','%(name)s')
class ComputedDogAttributes:
    def owner_name(dog): return dog.owner.name
db.dog.virtualfields.append(ComputedDogAttributes())
db.walk.dog.requires = IS_IN_DB(db,'dog.id','%(name)s by %(owner_name)
s')

Actually I have not tried it. If you do please let us know.


On Nov 10, 4:35 am, Frederik Wagner <fner...@googlemail.com> wrote:
> Hi .*,
>
> is there a possibility in the Validator IS_IN_DB to have the display
> string show attributes from multiple (joined) tables?
> E.g.: If I  say somthing like
>
> IS_IN_DB( db( (table1.id == table2.id_table1) , 'table1.id',
> '%(table1.attribute)s %(table2.attribute)s')
>
> It tried somthing like this, but the problem is, that the placeholder
> are always assumed to be attributes of the table used in the second
> parameterfield, here 'table1'. Such that the used attributes are
> 'table1.table1.attribute' and 'table1.table2.attribute', which is
> clearly an error.
>
> I hope I could make the problem clear?
>
> Thanks a lot for help.
> Bye!
> Frederik
--~--~---------~--~----~------------~-------~--~----~
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