I've tried to create my own auth table, but keep running into issues.
Here's the current version:
db.define_table(
"siteuser",
db.Field('user_id'),
db.Field('user_id__tmp'),
db.Field('firstname', length=128, default=''),
db.Field('lastname', length=128, default=''),
db.Field('email', length=128, default='', requires = [IS_EMAIL(),
IS_NOT_IN_DB(db,'%s.email'%'siteuser')]),
db.Field('password', 'password', readable=False, label='Password',
requires=CRYPT()),
db.Field('registration_key', length=128, writable=False,
readable=False,default=''),
db.Field('last_logged_in', type='datetime', default='now'),
db.Field('last_logged_in_from', length=36, default=''),
db.Field('created_on', type='datetime', default='now'),
db.Field('active', type='boolean', default=True)
)
auth=Auth(globals(),db) # authentication/authorization
# define custom tables (table_user_name is 'auth_user')
auth.settings.table_user_name = 'siteuser'
auth.define_tables() # creates all needed tables
Now I've received a plethora of different errors, but the current one
is:
ProgrammingError: relation "siteuser" does not exist
That makes no sense to me, as it's defined above. I've also tried
using auth.settings.table_user = db.define.... and then I get errors
about user_id__tmp missing or something.
Can anybody provide a complete example of how they extended the auth
user table? I'm using v1.64.4
Thanks!
-rob
On Jun 30, 10:01 am, mdipierro <[email protected]> wrote:
> Mind to this
>
> auth.settings.table_user_name = 'member'
>
> beforeauth.define_tables()
>
> On Jun 30, 2:09 am, Fran <[email protected]> wrote:
>
> > On Jun 30, 2:07 am, Mico Siahaan <[email protected]> wrote:
>
> > > 1. Can we rename the auth_user table to other for example to member
> > > table?
>
> > Yes:
> >auth.settings.table_user_name = 'member'
>
> > > 2. Can rename field id to other for example to memberId?
>
> > No
> > All Web2Py tables need a field called 'id'
>
> > F
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---