Field('timestamp', 'datetime', default=request.now, update=request.now)
is all you need to define to get what you're asking...
On Thursday, October 29, 2015 at 4:58:21 PM UTC+1, Laurent Lc wrote:
>
> Hi,
>
> i'd like a very simple example please (i begin) :
> could you tell me how to do for updating a field when i use sqlform.grid.
> Example:
> my db :
> db.define_table('message',
> Field('firstname',requires=IS_NOT_EMPTY()),
> Field('lastname',requires=IS_NOT_EMPTY()),
> Field('team',requires=IS_NOT_EMPTY()),
> Field('mail',requires=IS_EMAIL()),
> Field('title', requires=IS_IN_SET(['Mission', 'RH', 'IT']),
> default='RH' ),
> Field('your_message','text',default=VALUE),
> Field('timestamp', default=str(datetime.datetime.now())))
>
> now in my controller i return records as :
> records =
> SQLFORM.grid(db.message,user_signature=True,maxtextlength=100,orderby=~
> db.message.id,deletable=False,editable=True,create=False, \
> fields=[db.message.lastname,db.message.team,
> db.message.mail]
> )
>
> The goal is to edit one record and update automatically the field
> timestamp with the date of day .
>
> Thank you
>
--
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.