You need to define represent (ex.: db.table.field.represent = lambda value or id : ...)
Se the book. requires = good for drop box represent = good for select Richard On Tue, Oct 4, 2011 at 2:02 PM, David Marko <[email protected]> wrote: > I have two tables as you can see below describing common one-to-many > relationship. Company table has format property defined but in web2py > database admin, when listing persons(see attached screenshot) I just see > company id number instead of company name. I just thought that I should see > company name when format on company table is defined. I have the similar > tables in other web2py project and its working fine. Dont know whats wrong > here. Can somebody give me a hint? > > ## COMPANY > db.define_table('company', > Field('company_name','string', label='Company', > requires=IS_NOT_EMPTY()), > Field('mat_org','reference company', label='Parent company'), > > Field("ico", "string", label=T('ICO')), > Field("dic", "string", label=T('DIC')), > > Field("address", "string", label=T('Address')), > Field("city", "string", label=T('City')), > Field("zip", "string", label=T('ZIP')), > > Field("www", "string", label=T('WWW')), > Field("email", "string", label=T('Email')), > > Field("manager",db.auth_user, default=auth.user_id, label=T('Manager'), > requires=IS_IN_DB(db,"auth_user.id",'%(last_name)s %(first_name)s')), > > format='%(company_name)s', > migrate=MIGRATE > ) > > ##db.company.manager.requires=IS_IN_DB(db,"auth_user.id > ","auth_user.lastname") > > ##db.company.mat_org.requires=IS_EMPTY_OR(IS_IN_DB(db,"company.id > ",'%(company)s')) > > ## PERSON > db.define_table('person', > Field('company',db.company,label='Company', notnull=True, > requires=IS_IN_DB(db,"company.id",'%(company_name)s') ), > > Field('first_name','string', label='FirstName'), > Field('last_name','string', label='LastName', requires=IS_NOT_EMPTY()), > > Field('email','string', label='Email'), > Field('phone','string', label='Phone'), > Field('mobile','string', label='Mobile'), > > > format='%(last_name)s', > migrate=MIGRATE > ) > >

