This workd for me: import datetime
now = request.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('vendedor', SQLField('nome')) registos.define_table('obra', SQLField('numero', 'integer'), SQLField('nome', 'string'), SQLField('descricao', 'text', label='Descrição'), SQLField('cliente', registos.cliente), SQLField('vendedor', registos.vendedor), SQLField('entrada', 'date', default=now), SQLField('entrega', 'date')) registos.cliente.nome.requires = [IS_NOT_EMPTY(), IS_NOT_IN_DB (registos, 'cliente.nome')] registos.cliente.email.requires = IS_NULL_OR(IS_EMAIL()) registos.vendedor.nome.requires = IS_IN_SET(['João Luís', 'Luís Bilro', 'Luis Pereira', 'Paulo Gonçalves', 'Vitor Silva', 'Rujoca', 'Dacor']) 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.entrega.requires = IS_NOT_EMPTY() On Aug 12, 6:07 am, Carlos Aboim <abo...@gmail.com> wrote: > Ok, I've send it earlier but no problem > here it is :-)http://dpaste.com/hold/78289/ > > Hope it helps! > > Thanks in advanced > > Carlos Aboim > > 2009/8/12 mdipierro <mdipie...@cs.depaul.edu> > > > > > Just send me the model then. > > > Massimo > > > On Aug 12, 5:41 am, Carlos Aboim <abo...@gmail.com> wrote: > > > Tell me what files you whould need. Because this is just the model of a > > > future app. > > > I am populating the database througth the admin page... > > > > I am not a very well experienced user! > > > > Sorry for some lack of understanding :-) > > > > Carlos Aboim > > > > 2009/8/12 mdipierro <mdipie...@cs.depaul.edu> > > > > > Please email me the relevant parts of your app. This works for sure > > > > but I cannot tell what is wrong without looking at the code. > > > > > Massimo > > > > > On Aug 12, 4:58 am, Carlos Aboim <abo...@gmail.com> wrote: > > > > > I changed the fields name as suggested but no sucess!! > > > > > Any further clues? > > > > > > Thanks > > > > > Carlos Aboim > > > > > > 2009/8/12 Yarko Tymciurak <yark...@gmail.com> > > > > > > > Since you are having troubles, can I suggest you rename the > > following: > > > > > > > registos.obra.cliente > > > > > > and > > > > > > registos.obra.vendedor > > > > > > > to > > > > > > > registos.obra.cliente_id > > > > > > registos.obra.vendedor_id > > > > > > > This is because this field IS a foreign key, which holds the > > > > cliente.id.... Now you have TWO fields, "cliente" - one a table name, > > one a > > > > field > > > > > > name.... if you rename this, it will remind you better what you are > > > > looking > > > > > > at in your controllers. > > > > > > > See if this helps... > > > > > > > On Wed, Aug 12, 2009 at 4:14 AM, Carlos Aboim <abo...@gmail.com> > > > > wrote: > > > > > > >> I've you seen my dpaste?? > > > > > >> My models are like thishttp://dpaste.com/hold/78289/ > > > > > >> Is the field 'vendedor' in the table 'obras' that I am having > > trouble! > > > > > > >> May I use *required* parameter in the 'vendedor' field instead? > > > > > >> It seams so linear but I cant make it work! > > > > > > >> thank you > > > > > >> C Aboim > > > > > > >> 2009/8/12 mdipierro <mdipie...@cs.depaul.edu> > > > > > > >>> The only things I can think of are: > > > > > >>> 1) requires is mispelled > > > > > >>> 2) requires is overwritten somewhere else > > > > > > >>> Can you post the code? > > > > > > >>> On Aug 12, 3:23 am, Carlos Aboim <abo...@gmail.com> wrote: > > > > > >>> > Hi, > > > > > >>> > In fact I was using requires=[IS_IN_SET(…)] > > > > > > >>> > Changed to requires=IS_IN_SET(....), but still doesn't work!! > > > > > > >>> > help!! Thanks > > > > > > >>> > Carlos Aboim > > > > > > >>> > 2009/8/11 mdipierro <mdipie...@cs.depaul.edu> > > > > > > >>> > > requires=IS_IN_SET(....) > > > > > > >>> > > validation+dropdown > > > > > > >>> > > requires=[IS_IN_SET(....)] > > > > > > >>> > > validation but not dropdown. ;-) > > > > > > >>> > > On Aug 11, 11:01 am, Carlos Aboim <abo...@gmail.com> wrote: > > > > > >>> > > > Hi everyone > > > > > > >>> > > > I am using a model like: > > > > > > >>> > > >http://dpaste.com/hold/78289/ > > > > > > >>> > > > - the field 'vendedor' > > > > > >>> > > > - the field 'cliente' > > > > > > >>> > > > in model 'obras' should show a dropdown menu from IS_IN_SET > > > > > >>> ('vendedor') > > > > > >>> > > and > > > > > >>> > > > from other table reference ('cliente') parameter > > > > > >>> > > > but it doesn't show up no dropdown menus > > > > > > >>> > > > Any better aproach?? > > > > > > >>> > > > 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 -~----------~----~----~----~------~----~------~--~---