I assume this is a typo:

VirtualFields class:

should be

class VirtualFields:

What is the error? Can you show the traceback?

On Oct 21, 8:09 am, Savio Sabino <savi...@gmail.com> wrote:
> Hello.
> I did the following test with virtual fields:
>
> db.define_table('product',
>                Field ('type', db.tp_produto)
>                Field ('manufacturer', db.fabricante)
>                Field ('qt', 'integer', default = 0),
>                Field ('qt_min', 'integer', default = 0)
>                )
> db.product.type.requires IS_IN_DB = (db, db.tp_product.id, '% (name)
> s')
> db.product.manufacturer.requires IS_IN_DB = (db, db.manufacturer.id,
> '% (name) s')
>
> VirtualFields class:
>    def input(self): return self.product.qt_min * 2
> db.product.virtualfields.append(VirtualFields())
>
> The version of web2py in use is 1.87.3
>
> The new virtual field appears neither in the appadmin. What's missing?
>
> And, the line:
>
> db.produto.virtualfields.append(VirtualFields())
>
> causes error in the access tables below it.

Reply via email to