Re: [web2py] Re: SQLFORM.grid edit form restrictions

2013-12-04 Thread 黄祥
i think you can achieve it by improve the above example. e.g. not tested edit_in_form = 'edit' in request.args if not edit_in_form: db.product.price.label = T('Price Uneditable') else: db.product.price.label = T('Price Editable') best regards, stifan -- Resources: - http://web2py.com

Re: [web2py] Re: SQLFORM.grid edit form restrictions

2013-12-04 Thread Ivo
Thanks Stifan do you by any chance know how I can manipulate field values for the edit view, for example change the form labels and field values if they are read only? On Wednesday, December 4, 2013 9:00:23 AM UTC+1, 黄祥 wrote: > > i think you can figure it out by yourself where the 'edit' is p

Re: [web2py] Re: SQLFORM.grid edit form restrictions

2013-12-04 Thread 黄祥
i think you can figure it out by yourself where the 'edit' is passed in request.args. the minus part of list is tell that you must sort it backward (from right), so if it : request.args[-3] == 'edit' the edit must be the 3rd args from the right part for your case e.g. App/default/product/edit/(

Re: [web2py] Re: SQLFORM.grid edit form restrictions

2013-12-03 Thread Ivo
黄祥 you were right! I fixed the issue just by copy pasting your first solution. Very stange as I tries a almost identical solution that failed. I tried something like: edit_in_form = 'edit' in request.args db.product.price.readable = db.product.price.writable = not edit_in_form your second solution

Re: [web2py] Re: SQLFORM.grid edit form restrictions

2013-12-03 Thread Dave S
On Tuesday, December 3, 2013 3:52:12 PM UTC-8, Ivo wrote: > > I tried the sugested methods prior to posting because I came across a post > which had that solution in it. It doesn't throw the error, but ignores it > totally. > I think the issue is because the url of the form is > App/default/pro

Re: [web2py] Re: SQLFORM.grid edit form restrictions

2013-12-03 Thread 黄祥
> > App/default/product/edit/(record id)?(hmac) > if my logic is correct the edit is args so : edit_in_form = 'edit' in request.args or edit_in_form = request.args[-3] == 'edit' should work are you sure? i've tested right now, both is work in mine. tested in web2py 2.8.2 windows binary on windo

Re: [web2py] Re: SQLFORM.grid edit form restrictions

2013-12-03 Thread ivo . nijenhuis
I tried the sugested methods prior to posting because I came across a post which had that solution in it. It doesn't throw the error, but ignores it totally. I think the issue is because the url of the form is App/default/product/ And the edit function creates a url like App/default/product/edit

[web2py] Re: SQLFORM.grid edit form restrictions

2013-12-03 Thread Dave S
On Tuesday, December 3, 2013 3:25:06 PM UTC-8, 黄祥 wrote: > > please try not tested : > edit_in_form = 'edit' in request.args > db.product.price.writable = not edit_in_form > > or > > edit_in_form = request.args[-3] == 'edit' > db.product.price.writable = not edit_in_form > I'd expect the 2nd s

[web2py] Re: SQLFORM.grid edit form restrictions

2013-12-03 Thread 黄祥
please try not tested : edit_in_form = 'edit' in request.args db.product.price.writable = not edit_in_form or edit_in_form = request.args[-3] == 'edit' db.product.price.writable = not edit_in_form best regards, stifan -- Resources: - http://web2py.com - http://web2py.com/book (Documentation)