Not with the usual syntax. Looking for a way to allow this in the new form api
On Sun, Jun 16, 2019, 09:51 Fekete Zoltán <fekete.zol...@minux.hu> wrote: > Hi Massimo, > > In web2py I highly rely on dynamically modifiable forms. Based on > calculations some fields are required or even hidden, others not. > > Will be possible to do so in web3py? > > Thank you, > > FeZ > > On 2019. június 15. 8:17:43 Massimo Di Pierro <massimo.dipie...@gmail.com> > wrote: > >> db.tablename.fieldname.readable = False # SAFE >> def test(): >> db.tablename.fieldname.readable = False # NOT SAFE >> >> *models.py* >> def on_define_tablename(table): >> table.fieldname.readable = False # SAFE >> db.define_table('tablename', >> Field('fieldname'), >> on_define = on_define_tablename) >> >> BUT things like on_define = on_define_tablename >> are no longer necessary in web3py. Tables are defined when the files are >> imported not at every request (like in web2py) and therefore you do not >> need optimization tricks any more. >> >> >> On Friday, 14 June 2019 22:03:04 UTC-7, 黄祥 wrote: >>> >>> Be careful that you can no longer change attributes everywhere you like >>>> as in: >>>> >>>> db.tablename.fieldname.readable = False >>>> >>>> In web2py this is ok. In web3py this is not safe. Attributes must be >>>> global. The state of fixtures must not be modified inside actions. >>>> >>> >>> is it mean in controller not safe, but in on_define, safe or not ? >>> *e.g.* >>> *controller.py* >>> db.tablename.fieldname.readable = False # not safe in web3py >>> def test(): >>> db.tablename.fieldname.readable = False # not safe in web3py >>> >>> *models.py* >>> def on_define_tablename(table): >>> table.fieldname.readable = False # safe or not ? >>> db.define_table('tablename', >>> Field('fieldname'), >>> on_define = on_define_tablename) >>> >>> best regards, >>> stifan >>> >>> >>> -- >> 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/82e955db-788c-4280-9504-0bbd242882eb%40googlegroups.com >> <https://groups.google.com/d/msgid/web2py/82e955db-788c-4280-9504-0bbd242882eb%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > > -- 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/CAJYrZrnUquuSCkGkHYVPQ1CzQfZh2fsDLBKzZzQu1%3DjB2n6nYA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.