[web2py] Re: apply constraint on SQLFORM.grid buttons

2016-11-28 Thread 黄祥
a, u right, sorry, my bad, thanks for the correction, anthony. 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 mes

[web2py] Re: apply constraint on SQLFORM.grid buttons

2016-11-28 Thread Anthony
On Monday, November 28, 2016 at 6:47:21 PM UTC-5, 黄祥 wrote: > > pls try (not tested) : > def grid_constraints(): > table = db.test > query = table.created_by == auth.user_id > constraints = dict(test = query) > editable = True if query else False > No, that won't work -- "query" is a Query object,

[web2py] Re: apply constraint on SQLFORM.grid buttons

2016-11-28 Thread 黄祥
pls try (not tested) : def grid_constraints(): table = db.test query = table.created_by == auth.user_id constraints = dict(test = query) editable = True if query else False #editable = True grid = SQLFORM.smartgrid(table, constraints = constraints, editable = editable) return locals() ref: http://