The book states:
In fact db.tablename and "reference tablename" are equivalent field types.

But this seems to be true only if you are using a single database.  I had a
second database, db2 and defined a reference field to it as:
Field('myfield', db2.country)

and Web2Py created the field type: 'reference country' and assumed
db.country exists. complaining that 'country' doesnt exist. Of course,
there's no db.country, only db2.country. As a work around, I defined it as
an integer
Field('myfield', 'integer', requires=IS_IN_DB(db2, 'country.id',
db2.country._format)

It works for me and noticed that in appadmin, web2py no longer "sense" the
links between those tables if they are defined like the latter. Will this
cause me any problem in the future?

Reply via email to