Did you ever get this working?  I tried the same thing, adding

        Field.Virtual('last_first', lambda row: "%s, %s" % 
(row.auth_user.last_name, row.auth_user.first_name))

to auth.settings.extra_fields['auth_user'], but get the same error message 
when trying to build the SQLFORM.grid.

Tim


On Thursday, July 10, 2014 8:26:01 AM UTC-4, Fabiano Almeida wrote:
>
> Hi Massimo,
>
> I tried this:
>
> auth.settings.extra_fields['auth_user']= [
>         ...
>         Field('dept_grid', compute = lambda row: 
> Departamento[row['departamento_id']].nome if row['departamento_id'] else 
> None, label = 'Departamento'),
>         Field.Virtual('dept_name', lambda row: 
> Departamento[row.departamento_id].nome if row.departamento_id else None, 
> label = 'Departamento')]
>
> The compute field work, the virtual field does not work. And the error by 
> calling the table in SQLFORM.grid:
>
> AttributeError: 'Row' object has no attribute 'dept_name'
>
>
> Can I use virtual field to display information from another table?
>
> Thanks,
>
> Fabiano.
>
>
> 2014-07-10 3:55 GMT-03:00 Massimo Di Pierro <massimo....@gmail.com 
> <javascript:>>:
>
>> auth.settings.extra_fields['auth_user'] = [Field.Virtual(....), ... ]
>>
>>
>> On Wednesday, 9 July 2014 13:14:14 UTC-5, Fabiano Almeida wrote:
>>>
>>> Hi again,
>>>
>>> It's possible insert virtual field in auth_user? how?
>>>
>>> thanks,
>>>
>>> Fabiano.
>>>
>>  -- 
>> 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 web2py+un...@googlegroups.com <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to