I do not see anything wrong in it. If in the view you have something like {{=row.cliente}} that gives you the id you may want to try replace it with
{{=registos.obra.cliente.represent(row.cliente)}} On Aug 17, 9:39 am, Carlos Aboim <abo...@gmail.com> wrote: > Yah I am sorry... my nervous mind! > On saying "didn't worked" I meant there was no change. > On rendering I get the page with exactlly the same reference to the 'name' > field of database 'cliente' which is a reference to de 'cliente_id'. But I > wnat the string in it!! > > thank you and apologize for the mess > > Carlos Aboim > > 2009/8/17 mdipierro <mdipie...@cs.depaul.edu> > > > > > This correct. Can you explain better what you mean by "it did not > > work". Which is the controller that does not work. What is the view. > > What do you get instead? > > > On Aug 17, 3:32 am, Carlos Aboim <abo...@gmail.com> wrote: > > > Hi, > > > Didn't worked, maybe I missing something or do some error! > > > > this is my real model, with te last line added as suggested is it > > correct? > > > > thank you > > > Carlos Aboim > > > > # coding: utf8 > > > > import datetime > > > > now = datetime.datetime.now() > > > > registos=SQLDB("sqlite://registos.db") > > > > registos.define_table('cliente', > > > SQLField('nome', 'string'), > > > SQLField('contacto', 'string'), > > > SQLField('email'), > > > SQLField('morada', 'string', length=100)) > > > > registos.define_table('obra', > > > SQLField('numero', 'integer'), > > > SQLField('nome', 'string'), > > > SQLField('descricao', 'text', label='Descrição'), > > > SQLField('quantidade', 'integer'), > > > SQLField('cliente', registos.cliente), > > > SQLField('vendedor', default='Rujoca'), > > > SQLField('entrada', 'date', default=now), > > > SQLField('entrega', 'date'), > > > SQLField('preview', 'upload',)) > > > > registos.cliente.email.requires = IS_NULL_OR(IS_EMAIL()) > > > > registos.obra.numero.requires = [IS_INT_IN_RANGE(5000, > > > 50000),IS_NOT_IN_DB(registos, 'obra.numero'), IS_NOT_EMPTY()] > > > registos.obra.nome.requires = IS_NOT_EMPTY() > > > registos.obra.descricao.requires = IS_NOT_EMPTY() > > > registos.obra.cliente.requires = IS_IN_DB(registos, registos.cliente.id, > > > registos.cliente.nome) > > > registos.obra.vendedor.requires = IS_IN_SET(['João Luís', 'Luís Bilro', > > > 'Luís Pereira', 'Paulo Gonçalves', 'Vítor Silva', 'Rujoca', 'Dacor']) > > > registos.obra.entrega.requires = IS_NOT_EMPTY() > > > registos.obra.preview.comment = 'Utilize ficheiros em formato .jpeg de > > > preferência' > > > registos.obra.cliente.represent = lambda cliente: > > > registos.cliente[cliente].nome > > > > 2009/8/14 mdipierro <mdipie...@cs.depaul.edu> > > > > > db.dogs.owner_id.represent=lambda owner_id: db.users[owner_id].name > > > > > On Aug 14, 9:59 am, Carlos Aboim <abo...@gmail.com> wrote: > > > > > Hi folks! > > > > > I am here again as promised. (just kidding) > > > > > > I whould like to know how to access a cross reference model name. > > > > > For example to clarify, > > > > > I got: > > > > > > db.define_table('users', > > > > > Field('name'), > > > > > Field('email')) > > > > > > # ONE (users) TO MANY (dogs) > > > > > db.define_table('dogs', > > > > > Field('owner_id',db.users), > > > > > Field('name'), > > > > > Field('type'), > > > > > Field('vaccinated','boolean',default=False), > > > > > Field('picture','upload',default='')) > > > > > > And I want to render the 'owner' field of the 'dogs' table with the > > > > > 'name' from 'users' table > > > > > or better dogs.owner = users.name > > > > > > I'm just getting the _id of that field (integer) > > > > > > Can I do this?? > > > > > > Thank you > > > > > Carlos Aboim --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---