I try to define a lab_members table:
from gluon import current
current.auth = auth
db.define_table('lab_members',
Field('lab', db.auth_group, label='Lab Name',
represent=lambda id,row: str(row.role)+' Lab',
default=db.auth_group(current.auth.user_id) ),
Field('member',db.auth_user'),
)
But the default value doesn't work. I have tried also the "default=
auth.user_group(auth.user_id)" with no luck either.
What I would like to have, is the lab field pre-completed with the current
user group, and to be writable=False.
The error is:
<type 'exceptions.TypeError'> unsupported operand type(s) for %: 'bool' and
'Row'
If I put "default= db.auth_group(2),writable=False," there is no error, and
a user group is selected in the drop-down selection, but it is still
selectable by the user.
Any hints?
--