I try to use virtual fields.

I have the following in a model:

hb.define_table('entity',
   Field('name', 'string', unique=True),
   Field('group', 'reference pml_group'),
   Field('country', 'string'),
   Field('something','string'),
   Field('turnover','double'),
   Field('days','double'),
   Field('risk_class','integer',  default=1),
   format='%(name)s'
)

hb.entity.vfield = Field.Virtual(lambda row: row.entity.risk_class)

It seems to work, and when I select a row I get the new value.

The problem i face is that i get errors when I try to edit an entry using 
appadmin or crud:

Function argument list

(row=<Row {'extended_pml_entity': {'name': 'random_name', 'id': 55L}}>)

AttributeError: 'Row' object has no attribute 'risk_class'


Any idea of what might be wrong?

-- 

--- 
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/groups/opt_out.

Reply via email to