You are right... that needs to be fixed.
On Sunday, 14 July 2013 08:34:23 UTC-5, Woody wrote:
>
> Thanks for the clarification. This is what appears in the book:
>
> Mind that virtual fields do not have the same attributes as the other
> fields (default, readable, requires, etc). In older versions of web2py they
> do not appear in the list of db.table.fields and they require a special
> approach to display in SQLFORM.grid and SQLFORM.smartgrid. See the
> discussion on grids and virtual fields in the Forms chapter.
> *
> *
> The statement that it doesn't appear "in older versions" made me think
> that it would appear in the current version. Is it likely that this will
> work in some future version?
> *
> *
> On Sunday, July 14, 2013 5:18:26 AM UTC-4, Massimo Di Pierro wrote:
>>
>> No. This is the intended behavior.
>>
>>
>>
>> On Saturday, 13 July 2013 12:27:04 UTC-5, Woody wrote:
>>>
>>> I'm using version 2.5.1 stable and I've created a virtual field as part
>>> of a table definition, like this:
>>>
>>> db_mydb.define_table('my_table',
>>> Field('ROWID', 'id'),
>>> Field('test_field1', 'string', required=True),
>>> Field('test_field2', 'string', required=False),
>>> Field.Virtual('virtual_field_test', lambda row:
>>> "test_field"),
>>> Field('test_field3', 'string', required=False),
>>> migrate=False)
>>>
>>>
>>> The other fields show up in mydb.my_table.fields, but the virtual field
>>> does not. According to the documentation, this didn't work in "earlier
>>> versions", but I assumed that means that it does work in the current
>>> version. Is this a bug?
>>>
>>>
>>
--
---
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/groups/opt_out.