On Monday, March 19, 2018 at 10:43:16 PM UTC-7, Dave S wrote:
[...] 

> Also, you can turn the readable and writable setting on or off on the fly:
>
> <URL:
> http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Run-time-field-and-table-modification
> >
>

I have a couple examples on my home development machine 

 def func1(): 
    db.run.distance.readable = False
    db.run.duration.readable = False
    form = SQLFORM(db.run)
   [...]


def func2():
    if request.vars.startseg:
      try:
        db.segment.isstart.default = (request.vars.startseg == 'T' )
        print "isstart " + ('True' if db.segment.isstart.default  else 
"False")
        db.segment.isstart.readable = db.segment.isstart.default
        print "isstart should be readable now %d" % (db.segment.isstart.
readable)
      except ValueError:
        pass
    else:
        db.segment.isstart.writable = False
        print "isstart should not be readable now %d" % (db.segment.isstart.
writable)
    db.segment.isstart.writable = db.segment.isstart.default
    print "isstart should not be writable now %d" % (db.segment.isstart.
writable)
    form = SQLFORM(db.segment)
    [...]


I have yet to try using custom forms, although they pop up in threads from 
time to time.

/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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to