On Tuesday, September 13, 2011 12:59:41 PM UTC-4, Elcimar wrote:
>
> Hi folks, newbie question here. 
> I have a table 'mensagens' with a field: 
>
> SQLField("usuario", "integer", length=255, notnull=True, default=None, 
> represent = lambda id: db.acessos[id].nick) 
>
> Then, after adding some data to this table I try to view some records: 
>
> registros = SQLTABLE(db().select(db.mensagens.ALL)) 
>
> It works fine. But I don't need an SQLTABLE right now, I just need the 
> data, but if I do this: 
>
> registros = db().select(db.mensagens.ALL) 
>
> The 'represented' field shows its actual id instead of a 'nick'.
>

You can always call the represent function directly. E.g.:

db.mensagens.usario.represent(registros.first().usario)

Also, you should use Field() instead of SQLField() (no difference, but the 
latter has been deprecated).

Anthony 

Reply via email to