And do tables have represent?

if I specify a format string in define_table, isn't it a shortcut to
setting the represent attr of the table?


On Wed, Jan 6, 2010 at 01:54, mdipierro <[email protected]> wrote:
> Sorry. I am not sure I understand the question.
>
> This is not a valid expression:
>
>   db.post.widget = lambda id: 'e'
>
> Only fields have widgets, not tables. widgets for fields should be
> HTML helpers.
>
> Massimo
>
> On Jan 5, 5:40 pm, pihentagy <[email protected]> wrote:
>> 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 <[email protected]> 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 <[email protected]> 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 <[email protected]> wrote:
>>
>> > >> On Nov 18, 9:45 am, Wes James <[email protected]> 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 [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>
>
>
-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.


Reply via email to