yes, you have a nice trick on your code, thanks so much massimo
e.g.
# -*- coding: utf-8 -*-
# index
def index():
filename = os.path.join(request.folder, 'databases', 'idx_tables.index')
if not os.path.exists(filename):
# create index : auth_user
db.executesql('CREATE INDEX idx_auth_user ON auth_user (id, first_name,
last_name, email, username);')
# create index : auth_group
db.executesql('CREATE INDEX idx_auth_group ON auth_group (id, role);')
# create file index in databases folder
open(filename, 'w').write(datetime.datetime.now().isoformat() )
if db(db.add_group).isempty() and db(db.auth_user).isempty():
# group
auth.add_group('Admin', 'Admin')
# user
db.auth_user.bulk_insert([
{"first_name" : "Admin", "last_name" : "Admin",
"email" : "[email protected]", "username" : "admin",
"password" : db.auth_user.password.validate("password")[0] }, ] )
session.flash = T('Installation Done')
redirect(URL('default', 'index') )
best regards,
stifan
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
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/d/optout.