what's the way to store in db the user that perform the insert in db and the actual time stamp? I thought to resolve with the subsequant solution but with no success:

# db model
db.define_table('main_post',
    Field('title', required=True, notnull=True, label=T('Title')),
    Field('description', 'text', label=T('description')),
    Field('timeref', 'datetime',
        compute=lambda r: request.now,
        requires = IS_DATETIME(format=T('%Y-%m-%d %H:%M:%S'),
                       error_message=T('must be YYYY-MM-DD HH:MM:SS!'))
    )
    Field('owner', db.auth_user, required=True, notnull=True,
        compute=lambda r: auth.user.id,
        requires=IS_IN_DB(db, 'auth_user.id', '%(first_name)s')
    )
)

# controller
def index():
    form = SQLFORM(db.main_post)
    return dict(form=form)

on the submit it responds with a missing owner error message

thank you
cheers

        Manuele

Reply via email to