## additonal fields
auth.settings.extra_fields['auth_user']= [
Field('office')
]
So it will be like this...
auth = Auth(db, hmac_key=Auth.get_or_create_key())
crud, service, plugins = Crud(db), Service(), PluginManager()
## create all tables needed by auth if not custom tables
## additonal fields
auth.settings.extra_fields['auth_user']= [
Field('office')
]
auth.define_tables()
Hmm, I just added this this to db.py:
ReplyDeleteauth.settings.extra_fields['auth_group']= [
Field('user_type', type='integer')
]
but I don't see the new column in the database
Woops! You can add it before "auth.define_tables()".
DeleteIt will be like...
from gluon.tools import Auth, Crud, Service, PluginManager, prettydate
auth = Auth(db, hmac_key=Auth.get_or_create_key())
crud, service, plugins = Crud(db), Service(), PluginManager()
## create all tables needed by auth if not custom tables
auth.settings.extra_fields['auth_group']= [
Field('user_type', type='integer')
]
auth.define_tables()
I had to make sure that migrate=True was turned on after adding a phone field to my auth_user table.
ReplyDeleteauth.define_tables(username=True, signature=False,migrate=True)