It was Field('firma', db.firma), I added the requires parameter as a
desperate measure thinking that it will trigger the right
functionality. It really looks like a "glitch in the system". If it is
useful to you I can send you the whole app.

Radu (from Romania :)

On Jan 17, 6:29 pm, Massimo Di Pierro <massimo.dipie...@gmail.com>
wrote:
> Replace
>
>  Field('firma', db.firma, requires=[IS_IN_DB(db, 'firma.id', '%
> (nume)s')]),
>
> with
>
>  Field('firma', db.firma,  requires=IS_IN_DB(db, 'firma.id', '%
> (nume)s')),
>
> or even better
>
>  Field('firma', db.firma),
>
> the validator is automatic for reference fields.
>
>  Field('firma', db.firma, requires=[IS_IN_DB(db,
> 'firma.id', '%(nume)s')]),
>
> On Jan 17, 5:11 am, rif <feric...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Hi guys,
>
> > I just started working with web2py and I like it a lot. I have a
> > little problem with the following tables:
>
> > The firma field in the second table is shown as a text field where I
> > can only enter the ids and not as a select field. I admit that I might
> > have saved the db.py with firma field as a string first but now the
> > migration does not seem to take place.
> > I have other foreign key fields that are working fine but this one is
> > giving me troubles. Did I do something wrong here?
>
> > If you need more info please let me know.
>
> > Keep up the good work!
> > Radu
>
> > db.define_table('firma',
> >                 Field('nume', required=True, unique=True),
> >                 format='%(nume)s'
> >                 )
>
> > db.define_table('angajat',
> >                 Field('firma', db.firma, requires=[IS_IN_DB(db,
> > 'firma.id', '%(nume)s')]),
> >                 Field('nume', required=True),
> >                 Field('prenume', required=True),
> >                 Field('norma', 'integer', required=True,
> > requires=[IS_INT_IN_RANGE(1,10)]),
> >                 Field('activ', 'boolean', default=True),
> >                 format='%(nume)s %(prenume)s'
> >                 )

Reply via email to