Hi Yarko,
Thanks for the help!
I had initially tried doing what the introductory docs show (which is
marking a reference like ("image", db.image) for a column), which
fails because there is no member 'image' of db yet.
Then I consulted the technical docs and saw that instead "reference
image" should be used instead, so tried that, thinking that it would
be used as a placeholder (and filled in correctly later).
When that failed, I posted here.
The DAL doesn't recurse to allow this situation? Does anyone know
why / why not? When I get a chance I'll look at gluon and see how
trivial it would be to do, even in a hacky way.
I do have a separate issue now: following what you've suggested, I now
get complaints from gluon that referenced tables have duplicate field
names as the table being defined - did I miss something obvious? That
seems like there should be no issue doing so. (you can get this error
by simply copying and pasting the suggested fix you responded to me
with into a test db.py, even). Duplicate field names, but they're in
separate tables, so why the error?
Traceback (most recent call last):
File "gluon/restricted.py", line 178, in restricted
exec ccode in environment
File "/var/www/web2py/applications/golb/models/db.py", line 93, in
<module>
Field('published', 'boolean'))
File "gluon/sql.py", line 1304, in define_table
t._create_references()
File "gluon/sql.py", line 1579, in _create_references
raise SyntaxError, 'Field: table %s has same name as a field in
referenced table %s' % (self._tablename, referee._tablename)
SyntaxError: Field: table image has same name as a field in referenced
table person