[web2py] SQLFORM widgets and drop-down filtering

2018-04-08 Thread Dave S
I have a table that follows the following structure: db.define_table('collection', Field('IssueYr', 'integer', requires = [IS_NOT_EMPTY(), IS_INT_IN_RANGE(1965,2018, "Not a valid year of issue")], widget = lambda f, v: SQLFORM.widgets.in

[web2py] Using variables in db.table.field expressions

2018-04-08 Thread xelomac
Hi all, in a controller function I want to check if a field is set as writable in the model before updating it. "if db[table][column].writable == False" did not work. I have the following: def upd_field_value(): id,table,column = request.post_vars.id.split('.') value = request.post_vars

[web2py] Re: Using variables in db.table.field expressions

2018-04-08 Thread 黄祥
perhaps you can print the value of fields writable then compare it *e.g.* field_writable = db.table.field.writable *ref:* http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Run-time-field-and-table-modification best regards, stifan -- Resources: - http://web2py.com - h

[web2py] problem export virtual field to CSV using grid

2018-04-08 Thread Vic Ding
Hi all, I am having issue exporting virtual fields to CSV using grid. It displays fine though. I defined field in this way Field.Virtual('cost_value', lambda row: row.inventory.cost_price_avg * row.inventory.qty, label=T('Stock value')), When I export it to CSV in grid I got the following er

[web2py] Re: Using variables in db.table.field expressions

2018-04-08 Thread Anthony
On Sunday, April 8, 2018 at 4:27:59 AM UTC-4, xelomac wrote: > > Hi all, > > in a controller function I want to check if a field is set as writable in > the model before updating it. "if db[table][column].writable == False" did > not work. > What do you mean by "did not work"? That is the correc

[web2py] Re: Using variables in db.table.field expressions

2018-04-08 Thread xelomac
Sorry - I cannot comprehend what I have done wrong before. "if db[table][column].writable == False:" works now as expected. On Sunday, April 8, 2018 at 5:44:55 PM UTC+2, Anthony wrote: > > On Sunday, April 8, 2018 at 4:27:59 AM UTC-4, xelomac wrote: >> >> Hi all, >> >> in a controller function I

[web2py] How to retrieve info about sessions when they are stored in Redis?

2018-04-08 Thread Lisandro
Recently I moved the sessions from the database to Redis, and I'm wondering: is there a way to retrieve info about sessions when they are stored in Redis? For example, when sessions are stored in the database, you have the option to use SQL to do some stuff like counting or deleting sessions. H

Re: [web2py] Re: Error loging in after authentication changes

2018-04-08 Thread Maurice Waka
I moved the iteration to the controller side and it worked. Regards On Sat, Apr 7, 2018 at 5:36 PM, Anthony wrote: > Also, there is not point to either of the for loops at the top of the view > -- each loop is simply assigning a new value to the same variable, so the > final value of the variabl