On Monday, June 10, 2019 at 4:42:52 PM UTC-7, Dave S wrote: > > > > On Monday, June 10, 2019 at 4:11:25 PM UTC-7, Quang Lam wrote: >> >> Hi Dave, if i set the mode field to readable false and writable true, how >> i can display the mode field in the view page. i know we can make it >> temporarily readable true but i dont know how. >> Please help. >> >> > I'm going to wait to answer until I can access a system that isn't at the > same site I am right now. > > Here's what I tried:
I took an existing form, and in the controller that displays and processes it, I set db.mytble.PostDate.default=datetime.date(2001,07,14) and db.mytble.PostDate.writable = false. (It isn't set that way in the define_table()). The form displays the current date, but as a string and not as an input box. I submit the form, and in the accept branch I do: if form.process().accepted: print form.vars set form.vars.PostDate to request.now.date() thisrow - db(mytable.id == form.vars.id).select().first() thisrow.update_record(PostDate = form.vars.PostDate) After submitting, I look at the console and see that form.vars does not include form.vars.PostDate. I use appadmin to check the database, and I find that the current date is recorded in the database.in the new row. And in case there is a difference in the enforcement of writable, I did do a quick check of setting writable = False in the define_table(Field()). No difference that I could see. Caveat: I did this with 2.14.6; it's a site only visible on my localhost, so I've been slow to update. I do have 2.18.x installed on the same machine, but I haven't moved my apps over yet. /dps -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/f245ca7f-7291-4984-bc5f-f23fa26ce552%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.