2011/1/21 web2py noob <web2py.n...@gmail.com>

> bruno, as you say above is wrong. the workaround is:
>
> db.define_table('tablename',
>    Field('fieldname',db.othertable, represent=lambda f:
> db.othertable[f].fieldname)
> )
>
> best regards.


 This is what I have working here:

db.define_table('father',
           Field('name'),
           format='%(name)s' # this format is not working on SQLTABLE as
reported by many users.
           )

db.define_table('son',
           Field('name'),
           Field('father_id',db.father,represent=lambda r:r.name), #this is
the workaround
           format='%(name)s'
          )

That is what I got in *SQLTABLE*

 my_sqltable :
  son.id son.name son.padre 1 Mike John

without that workaround we got:

 my_sqltable :
  son.id son.name son.padre 1 Mike 1


with format='%(name)s' it is rendering as:
 my_sqltable :
  son.id son.name son.padre 1 Mike None

Reply via email to