to a specific field to show on table, it works to me with: Field('codigo', requires = IS_IN_DB(db, 'natureza_despesa.id', '%(codigo)s - %(especificacao)s'), represent= lambda codigo: db.natureza_despesa[codigo].codigo + ' - ' + db.natureza_despesa[codigo].especificacao ),
requires makes it works on forms represent makes work on table (webgrid slice). 2010/1/5 pihentagy <pihent...@gmail.com> > Hi! > > I also have a similar problem: > > Doing the blog crash course: > > db.define_table('post', > Field('title',length=256), > Field('body','text',requires=IS_NOT_EMPTY()), > Field('author',db.auth_user)) > > db.post.widget = lambda id: 'e' > db.post.title.represent = lambda title: B(title) > > db.define_table('comment', > Field('post',db.post, writable=False,readable=False), > Field('author',db.auth_user,writable=False,readable=False), > Field('body','text',requires=IS_NOT_EMPTY())) > > Field representation works in the appadmin (post title is bold), but > table representation not. (trying to insert a comment, and post is not > a dropdown) > The new format="hello" for the post table works. > The author field is displayed correctly (as a dropdown box) > > thanks > Gergo > > On Nov 18 2009, 6:02 pm, Wes James <compte...@gmail.com> wrote: > > Ah - it's probably this in t2.itemize > > > > defrepresent(t,r): > > try: return t.represent(r) > > except KeyError: return '[#%i] %s' % (r.id,r[t.fields[1]]) > > > > ?? > > > > -wes > > > > On Wed, Nov 18, 2009 at 9:57 AM, Wes James <compte...@gmail.com> wrote: > > > In the past, I have been able to do arepresentwith a table. > > > > > Massimo - was that a T2 only thing? > > > > > -wes > > > > > On Wed, Nov 18, 2009 at 9:49 AM, DenesL <denes1...@yahoo.ca> wrote: > > > > >> On Nov 18, 9:45 am, Wes James <compte...@gmail.com> wrote: > > >>> In db.py i have: > > > > >>> db.student.represent=lambda row: TABLE(TR('yep')) > > > > >> You are missing table or field here > > >> db.table.field.represent=... > > > > >>> just to see what happens with > > > > >>> {{=form}} (in my previous email /app/default/profile) > > > > >>> but it seems to be ignored. Any idea why? I put a break point in > > >>> there in wingide and it seems to process the line. > > > > >>> thx, > > > > >>> -wes > > -- > You received this message because you are subscribed to the Google Groups > "web2py-users" group. > To post to this group, send email to web...@googlegroups.com. > To unsubscribe from this group, send email to > web2py+unsubscr...@googlegroups.com<web2py%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/web2py?hl=en. > > > > -- Atenciosamente -- ========================= Alexandre Andrade Hipercenter.com--
You received this message because you are subscribed to the Google Groups "web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/web2py?hl=en.