good. Thanks for letting us know it is solved.
On Aug 12, 10:58 am, Carlos Aboim <[email protected]> wrote:
> Hi folks
> For the start I want to really thanks your support.
> I solved the problem already.
>
> As matter of fact I was connecting to other table which is not what I
> wanted.
> I really wanted access just the names as properties of one field of the main
> table.
>
> So I changed the table 'fornecedores' to inside the table 'obras' (main
> table)
> and know it works pretty well.
> On the cliente table there was some confusion too because was left to say
> what database and table were the references to that field
>
> for the ones who want to compare that is:
> earlier modelshttp://dpaste.com/hold/78289/
> last and actual modelshttp://dpaste.com/hold/78807/
>
> thanks again for your pacience
> be happy
> Carlos Aboim
>
> 2009/8/12 Carlos Aboim <[email protected]>
>
> > I have copied and pasted you reply code but it seems not working!
>
> > I cant tell what it is!
>
> > Do you know any exemples online that a could study?
>
> > Same reference or tutorial. I've searched but didn't find any!
>
> > thanks
> > CAboim
>
> > 2009/8/12 mdipierro <[email protected]>
>
> >> yes. It does for me.
>
> >> Try cut and paste the code I posted into your admin.
>
> >> On Aug 12, 8:25 am, Carlos Aboim <[email protected]> wrote:
> >> > Thank you for your breafly replies,
> >> > It is well seen, but I am affraid it is not that yet!!
>
> >> > How I wish it whould...!
>
> >> > the form to fill in a 'obra' in the admin page shows up perfectlly
> >> > when I 'click' inside the input box of the field 'vendedor' it is
> >> supposed
> >> > to appear a dropdown list with the IS_IN_SET() values wright??
>
> >> > but in fact it turns the background of the box into magenta but no
> >> dropdown
> >> > list :-(
>
> >> > I don't know what to do!
>
> >> > Carlos Aboim
>
> >> > 2009/8/12 mdipierro <[email protected]>
>
> >> > > I think I know why it did not work before.
>
> >> > > you have
>
> >> > > requires = IS_IN_SET(..),IS_NOT_EMPTY()
>
> >> > > the second validator is not necessary but the presence of "," makes
> >> > > python interpret this as
>
> >> > > requires = (IS_IN_SET(..),IS_NOT_EMPTY())
>
> >> > > I remover the braces and the second validator.
>
> >> > > Massimo
>
> >> > > On Aug 12, 7:59 am, mdipierro <[email protected]> wrote:
> >> > > > removed the [...] in this line:
>
> >> > > > registos.vendedor.nome.requires = IS_IN_SET(['João Luís', 'Luís
> >> > > > Bilro', 'Luis Pereira', 'Paulo Gonçalves', 'Vitor Silva', 'Rujoca',
> >> > > > 'Dacor'])
>
> >> > > > On Aug 12, 7:55 am, Carlos Aboim <[email protected]> wrote:
>
> >> > > > > less:
> >> > > > > now = request.now
>
> >> > > > > what were the changes you made.
>
> >> > > > > It seems to me that is the same code?
> >> > > > > Have you changed something else?
>
> >> > > > > thanks
> >> > > > > Carlos Aboim
>
> >> > > > > 2009/8/12 mdipierro <[email protected]>
>
> >> > > > > > 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 <[email protected]> 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 <[email protected]>
>
> >> > > > > > > > Just send me the model then.
>
> >> > > > > > > > Massimo
>
> >> > > > > > > > On Aug 12, 5:41 am, Carlos Aboim <[email protected]> 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 <[email protected]>
>
> >> > > > > > > > > > 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 <[email protected]>
> >> wrote:
> >> > > > > > > > > > > I changed the fields name as suggested but no sucess!!
> >> > > > > > > > > > > Any further clues?
>
> >> > > > > > > > > > > Thanks
> >> > > > > > > > > > > Carlos Aboim
>
> >> > > > > > > > > > > 2009/8/12 Yarko Tymciurak <[email protected]>
>
> >> > > > > > > > > > > > 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 <
> >> > > > > > [email protected]>
> >> > > > > > > > > > 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 <[email protected]>
>
> >> > > > > > > > > > > >>> 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 <
> >> [email protected]>
> >> > > 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 <[email protected]>
>
> >> > > > > > > > > > > >>> > > requires=IS_IN_SET(....)
>
> >> > > > > > > > > > > >>> > > validation+dropdown
>
> >> > > > > > > > > > > >>> > > requires=[IS_IN_SET(....)]
>
> >> > > > > > > > > > > >>> > > validation but not dropdown. ;-)
>
> >> > > > > > > > > > > >>> > > On Aug 11, 11:01 am, Carlos Aboim <
> >> > > [email protected]>
> >> > > > > > 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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---