I want to set username (Not id) to table when the record is created
using "import_from_csv_file".
The following model cause error because when you open the website
auth.user_id is None.

Can we set if statement says auth.user_id !=none,
dba.auth_user(auth.user_id).username.upper() else "" ?

Model
---------------------------
db.define_table('IQWAGFTY',
    Field('TYPRCD', length=15),
    Field('TYUUSR', length=128,
default=dba.auth_user(auth.user_id).username.upper()),
    Field('TYUDAT', 'datetime', default=request.now),
    primarykey=['TYPRCD'])

I added the following after the table definition but strangely,
"import_from_csv_file" doesn't pick up the default value if it's
defined after define_table.

if (auth.user_id != None):
 
db.IQWAGFTY.default=dba.auth_user(auth.user_id).username.upper()





Reply via email to