Note, although good practice, you don't technically have to set writable to False, you just have to make sure no value is submitted for that field when doing an update, as the "update" attribute is intended as a default value when the record is updated (by definition, defaults apply only when an explicit value is not provided).
Anthony On Thursday, October 15, 2015 at 11:29:04 PM UTC-4, Tom Clerckx wrote: > > Today I was struggling with why the following did not work for me in one > of my tables: > > Field('modified_on', 'datetime', default=request.now, update=request.now) > > > After some fiddling I found that writable=False must be explicitly added for > this to work properly. > > > --> Field('modified_on', 'datetime', default=request.now, update=request.now, > writable=False) > > > I understand that it does not make sense to have writable=True when you added > update=... to a field (same counts if you use compute), but I believe it does > make sense to add this in the documentation (in the DAL chapter describing > the Field constructor) - just so other people don't waste time figuring this > out. > > > Best regards, > > Tom. > > -- 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.