Up. Em terça-feira, 11 de setembro de 2012 18:35:25 UTC-3, Pepe Araya escreveu: > > Hello, > I need to display the format value of the referenced table in a > list:reference and not the list of ids. > > I have these tables: > db.define_table('personas', > Field('nombres'), > Field('apellidos'), > format='%(nombres)s %(apellidos)s') > > db.define_table('publicaciones', > Field('titulo'), > Field('descripcion', 'text', label='Descripción'), > Field('autores', 'list:reference db.personas', > requires= IS_IN_DB(db, 'personas.id', '%(nombres)s > %(apellidos)s', multiple=True)), > format='%(titulo)s') > > this controller function: > def filtro(): > tipo = request.args(0) > lista_publicaciones = db(db.publicaciones.tipo == tipo).select(orderby > =~ db.publicaciones.fecha) > if lista_publicaciones: > lista_publicaciones=lista_publicaciones > else: > lista_publicaciones = "0" > return dict(lista_publicaciones=lista_publicaciones) > > and this in the view: > > {{if lista_publicaciones !='0':}} > > {{for publicacion in lista_publicaciones:}} > <div class="ez-fl bloque-filtro-66"> > > <h2><a > href="{{=URL('publicaciones','ver_publicacion', args=publicacion.id)}}" > >{{=publicacion.titulo}}</a></h2> > Autores: {{=publicacion.autores}} > > {{=XML(publicacion.descripcion)}} > </div> > {{pass}} > {{else:}} > something... > {{pass}} > > using this in the view: > {{=db.publicaciones.autores.represent(publicacion.autores) }} > > I get this error: > <type 'exceptions.TypeError'>('NoneType' object is not callable) > > If I use: > Autores: {{=publicacion.autores}} > > I get: > Autores: [5,66] > > and I want: > > Autores: nombres apellidos, nombres apellidos > > Please, any help is welcome. > Thanks. > >
-- 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.