Thank you very much - that is the solution! I have spent some hours... Therefore I think, this is a very important hint - is it in the book?
2012/1/18 Massimo Di Pierro <[email protected]> > 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. > Ok, I will try this too. But my example is very simplified, the real application needs a little bit more code. > > On Jan 18, 9:05 am, Martin Weissenboeck <[email protected]> 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 >

