If you benefit from web2py hope you feel encouraged to pay it forward by contributing back to society in whatever form you choose!

how we can use another table field as a reference of auth_user table

Answers (1)

Comments (1)

  • Login to post



  • 0
    stevevanchristie 5 years ago

    please try, n next time, please post your question in the web2py forum
    db.define_table('bank',
        Field('name'),
        format = '%(name)s')

    auth.settings.extra_fields['auth_user'] = [
        Field('bank', 'reference bank',
              label = T('Bank'),
              notnull = True,
              required = True,
              requires = IS_IN_DB(db, db.bank.id, '%(name)s') ),
    ]

    auth.define_tables(username = True, signature = True)

    custom_auth_table = db[auth.settings.table_user_name]

    auth.settings.table_user = custom_auth_table
     

Related content


Hosting graciously provided by:
Python Anywhere