for me it's worst than before!
what is other_table? Why you don't use row? I don't understand...I'm sorry

Il giorno venerdì 26 gennaio 2018 10:50:49 UTC+1, Massimiliano ha scritto:
>
> The first argument of the represent function is the field value.
> So in the the second example the `id` arg is the other_id value.
>
> Maybe the example could be more clear in this way:
>
> db.mytable.other_id.represent = lambda id, row: db.other_table[id].other_field
>
>
> On Fri, Jan 26, 2018 at 10:24 AM, Andrea Fae' <[email protected] 
> <javascript:>> wrote:
>
>> "Represent" from web2py book....
>>
>> But what exactly are the relationship between "other_id" and "is" in the 
>> second example?
>> And in the third from what is get the variable "value"?
>> Thank you
>>
>> .represent can be None or can point to a function that takes a field 
>> value and returns an alternate representation for the field value.
>>
>> Examples:
>>
>> 1
>> 2
>> 3
>>
>> db.mytable.name.represent = lambda name, row: 
>> name.capitalize()db.mytable.other_id.represent = lambda id, row: 
>> row.myfielddb.mytable.some_uploadfield.represent = lambda value, row: A('get 
>> it', _href=URL('download', args=value))
>>
>> -- 
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Massimiliano
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to