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...

Reply via email to