A field has two attributes, requires and represent. If web2py finds a 'reference auth_user" but no requires, it assumes
db.report.person.requires=IS_IN_DB(db, db.auth_user.id, db.auth_user._format) db.report.person.represent = lambda id: db.auth_user._format % db.auth_user[id] If you give a custom requires, you also need a custom represent or you do not get one. In your case it would be easier to do: db.auth_user._format = '%(last_name)s' and use the default ones. On Jan 18, 9:05 am, Martin Weissenboeck <mweis...@gmail.com> wrote: > Hi, > > that's my model > > db.define_table('report', > Field('person', 'reference auth_user', > #requires=IS_IN_DB(db, db.auth_user.id, "%(last_name)s" ), # <------ > look here > ), > Field('text'),) > > and that's a function: > > def report(): > grid = SQLFORM.smartgrid(db.auth_user, > linked_tables=['report'], > user_signature = False) > return locals() > > No problems with a comment in line 3. > After removing the '#' and activating line 3 my grid doesn't show the name > of the person but only the record number (the id). > > Why? > > I have tried: > > IS_IN_DB(db, db.auth_user.id, "%(last_name)s" ) > IS_IN_DB(db, db.auth_user, "%(last_name)s" ) > IS_IN_DB(db, 'auth_user.id', "%(last_name)s" ) > IS_IN_DB(db, db.auth_user) > > Regards, Martin