On Monday, July 2, 2018 at 4:38:27 AM UTC-7, Diego Tostes wrote:
>
> Hi,
>
> i have this table:
>
> [...] 
>
Produto = db.define_table('produto',
>     Field('ficha_tecnica', 'upload', label=T("Ficha Tecnica")),
>     Field('descricao_produto', 'string', label=T("Descricao Produto")),
>     Field('foto_frente', 'upload', label=T("Foto Frente")),
>     Field('foto_costas', 'upload', label=T("Foto Costas")),
>     Field('foto_detalhe', 'upload', label=T("Foto Detalhe")),
>     Field('cliente_id', db.clientes, label=T("Cliente ID")),
>     [...] 
>
   Field.Virtual('tempo_total', lambda row: tempo_total_produto(
> row.produto.id)),
> )
>
>
> #REQUIRES
> Produto.cliente_id.requires = IS_IN_DB(db(Clientes), 'clientes.id', 
> '%(nome_cliente)s')
>
>
>
I'm just going by the first example I find in the book 
<URL:http://web2py.com/books/default/chapter/29/07/forms-and-validators#Links-to-referencing-records>
but should this be:
db.produto.client_id.requires = IS_IN_DB(db, db.clientes.id, 
'%(nome_cliente)s')


I don't know if the parser is confused by using the PRODUCTO and the 
db(Clientes), but I would try without them just to be sure.
You're getting a null string when it is looking for a string that makes a 
long, presumably trying for the id field.

/dps




-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to