Why not define tableX before auth.define_tables? I'm doing that with a table and it seems to work. Caveat: there's no controller for that table so it only gets exposed to the site owner.
On Oct 25, 8:44 am, Massimo Di Pierro <[email protected]> wrote: > this will work > > auth.settings.extra_fields['auth_user'] = [Field('myFK_id', 'reference > tableX')] > > You cannot use db.tableX because that is not yet defined. > On Oct 25, 12:20 am, Alex <[email protected]> wrote: > > > > > > > > > Hi, > > I have a simple question : I would like to add a foreign key to the > > table auth_user, but I don't know how to do that. > > I can add a text field easily. For example : > > > auth = Auth(db) > > auth.settings.extra_fields['auth_user'] = [Field('city')] > > auth.define_tables() > > > But if I do this, it doesn't work: > > > auth = Auth(db) > > auth.settings.extra_fields['auth_user'] = [Field('myFK_id', > > db.tableX)] > > auth.define_tables() > > > db.define_table('tableX', .....) > > > I can't find anything on the Web...

