You need to change the order

db.define_table('person',
    Field('name',readable=False),
    Field('company',db.company,label='Firma',readable=False),
    Field('role',label='Rolle',readable=False),
)
db.define_table('company',
    Field('name', readable=False),
)
db.define_table('document',
    Field('name'),
    Field('file','upload'),
    Field('filename','string',writable=False,label='Dateiname'),
    Field('person',db.person),
 )

db.document.person.requires=IS_EMPTY_OR(IS_IN_DB(db,'person.id', '%
(name)s %(company)s'))






On Mar 10, 5:20 am, Norbert Klamann <norbert.klam...@googlemail.com>
wrote:
> Hello all,
> I want to shoe in the select list a field from another table and don't know
> how to do it.
>
> I want to show a select list for persons with their name and the name of the
> company to which they belong
>
> Consider the following model
> db.define_table('document',
>     Field('name'),
>     Field('file','upload'),
>     Field('filename','string',writable=False,label='Dateiname'),
>     Field('person',db.person),
>  )
>
> db.document.person.requires=IS_EMPTY_OR(IS_IN_DB(db,'person.id', '%(name)s
> %(company)s')) ###### here i can only show  the number !
>
> db.define_table('person',
>     Field('name',readable=False),
>     Field('company',db.company,label='Firma',readable=False),
>     Field('role',label='Rolle',readable=False),
> )
> db.define_table('company',
>     Field('name', readable=False),
> )
>
> Thanks a lot
>
> Norbert

Reply via email to