@黄祥,
Below is my complete db.py, I am getting error in registration of user
stating gender can't be null.
# -*- coding: utf-8 -*-
from gluon.tools import Auth
db = DAL("sqlite://storage.sqlite")
auth = Auth(db)
auth.settings.create_user_groups=True
auth.define_tables(username=False, signature=True)
db.define_table('person',
Field('name', requires=IS_NOT_EMPTY()),
Field('married', 'boolean'),
Field('gender', requires=IS_IN_SET(['Male', 'Female', 'Other'])),
Field('phone', 'integer'))
auth.settings.extra_fields['auth_user']=[
Field('gender', 'list:string', notnull=True),
Field('address', 'text', notnull=True),
Field('zip', length=10, notnull=True),
Field('city', length=10, notnull=True),
Field('country', length=10, notnull=True),
Field('phone', length=10, notnull=True, unique=True),
Field('company', 'reference company', notnull=True)]
from gluon.contrib.populate import populate
if db(db.auth_user).isempty():
auth.add_group('Manager', 'Manager')
auth.add_group('Admin', 'Admin')
auth.add_membership('1', '1')
auth.add_membership('2', '1')
auth.add_membership('2', '2')
db.auth_user.bulk_insert([{'first_name' : 'Manager', 'last_name' :
'Manager',
'email' : '[email protected]',
'password' :
db.auth_user.password.validate('password')[0],
'gender' : 'Male', 'address' : 'Address',
'zip' : '11111',
'city' : 'Jakarta', 'country' : 'Indonesia',
'phone' : '1',
'company' : 1},
{'first_name' : 'Admin', 'last_name' :
'Admin',
'email' : '[email protected]',
'password' :
db.auth_user.password.validate('password')[0],
'gender' : 'Male', 'address' : 'Address',
'zip' : '11111',
'city' : 'Jakarta', 'country' : 'Indonesia',
'phone' : '2',
'company' : 1}])
--
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.