El lunes, 23 de abril de 2012 22:43:39 UTC-3, Anthony escribió:
>
> tb_categorias.format = '%(nombre)s'              #This does not work
>>
>> tb_obras.categoria.requires = IS_IN_DB(db, tb_categorias.id, 
>> '%(nombre)s') 
>>
>
> Both the "format" argument to define_table() and the "label" argument to 
> IS_IN_DB() can be a function that takes a row, so you can just define a 
> function that takes a record from categorias and returns the label. If 
> that's all you need nombre() for, then you don't even have to bother making 
> it a virtual field. If you need a virtual field for other purposes and 
> don't want to have to write the function twice, I'm not sure if it would 
> work, but you might even be able to do lambda r: r.nombre. Note, you 
> might consider using a new style virtual 
> field<http://web2py.com/books/default/chapter/29/6#New-style-virtual-fields-%28experimental%29>
> .
>
> Anthony
>

Thanks Anthony. I was trying to do something not very orthodox and I thought it 
would work. I'll try another way.

Jose 

>  
>

Reply via email to