Re: [web2py] define represent in a Controller

2011-08-31 Thread Bruno Rocha
> I have only one more question: in which cases is right to define this in the controller? There is no rule, when the thing is global define in model, when is specific to an action define it in the action. represent works for crud,read ans crud.select forms, and some widgets also uses it. --

Re: [web2py] define represent in a Controller

2011-08-31 Thread Pepe Araya
Thanks! I'm very grateful for your help! I have only one more question: in which cases is right to define this in the controller? You says: you can define a represent in controller before creating the table or form. db.table.field.represent = lambda . that is for Table and Form Helpers? A

Re: [web2py] define represent in a Controller

2011-08-31 Thread Bruno Rocha
you can put the attribution outside the loop, this will always be the same. {{represent =* db.postulaciones.estado_postulacion.represent*}} {{for postulacion in lista_postulaciones:}} {{=postulacion.postulaciones.id}} {{=postulacion.postulaciones.fecha_post

Re: [web2py] define represent in a Controller

2011-08-31 Thread Pepe Araya
In that way it not work, but I tried this: {{for postulacion in lista_postulaciones:}} {{represent =*db.postulaciones.estado_postulacion.represent *}} {{=postulacion.postulaciones.id}} {{=postulacion.postulaciones.fecha_

Re: [web2py] define represent in a Controller

2011-08-31 Thread Bruno Rocha
Sorry, I am wrong.. the correct should be {{represent = postulacion.postulaciones.estado_postulacion.*represent*}} {{=*represent(postulacion)*}}

Re: [web2py] define represent in a Controller

2011-08-31 Thread Pepe Araya
I get this error: AttributeError: 'str' object has no attribute 'represent'

Re: [web2py] define represent in a Controller

2011-08-31 Thread Bruno Rocha
does it work for you? {{=postulacion.postulaciones.estado_postulacion.*represent()*}}

Re: [web2py] define represent in a Controller

2011-08-31 Thread Pepe Araya
Thanks Bruno! I'm doing something wrong: *my controller*: def index(): db.postulaciones.estado_postulacion.represent = lambda r:db.estados_postulacion[r].nombre lista_postulaciones = db(db.postulaciones.postulante == db.auth_user.id).select() return dict( lista_postulaciones = lis

Re: [web2py] define represent in a Controller

2011-08-31 Thread Bruno Rocha
you can define a represent in controller before creating the table or form. db.table.field.represent = lambda . But, if you want to display the representation of a field without a table or form, do: {{=myrows.mycolumn.represent()}}

[web2py] define represent in a Controller

2011-08-31 Thread Pepe Araya
Hi! I really can't get this done, please, any help is welcome. Consider that I have this tables: # models/db.py # db.define_table('auth_user' ... ) db.define_table('estados_postulacion', Field('nombre'), Field('descripcion'), format='[%(id)s] %(nombre)s') db.define_table('postulacione