[web2py] Re: Smartgrid link very slow.

2019-04-23 Thread dgmanns
I discovered why my smartgrid (and grids) were very slow. = I had neglected to set searchable=False, sortable=False. With those options disabled (I need neither), performance is very good. It is the searchable option that is very costly. It would probably be good to highlight this in the docume

[web2py] Re: Smartgrid link very slow.

2019-04-16 Thread David Manns
The problem is with SQLFORM.grid Table Affiliations has some 5,000 rows. Each row has references to 2 other tables, Members and Colleges each of which has format=... so it displays text rather than the id as a number. So SQLFORM.grid(db.Affiliations.Member==, will correctly display only t

[web2py] Re: Smartgrid links with many-to-many join tables

2018-09-17 Thread Massimo Di Pierro
It is not that it does not work. it just treats a link table as a normal table, instead it should hide it and only use it to build the queries. it is not a hard change to make but we never got to make it because we always plant to reimplement the grid in a more modular manner On Monday, 3 Septe

[web2py] Re: Smartgrid links with many-to-many join tables

2018-09-03 Thread miiheikk
Hi, thanks for taking the time to answer. I quickly tested this and it's effectively the solution I referred to as circumventing the problem. I could define controller functions (response mappings) manually and then lambdaing the links to them, but it'd require a lot of code and I'd lose the r

[web2py] Re: Smartgrid links with many-to-many join tables

2018-09-02 Thread Massimo Di Pierro
How about this? def grid(): form = SQLFORM.grid(db.thing_a, links=[lambda row: A('b things', _href=URL('grid_b',args=row.id))]) return locals() def grid_b(): a_id = request.args(0) query = (db.thing_b.id==db.join_table.b_id) & (db.join_table.a_id==a_id) filelds = columns = [

Re: [web2py] Re: smartgrid - limit dropdown menu items in edit form

2018-01-04 Thread Paul Ellis
Your assumption is correct and the solution worked perfectly. I didn't realise I could use the requires method in that way. I have now read more about it. Thanks On Tue, Jan 2, 2018 at 3:25 PM, Jim S wrote: > I'm assuming you have a company_id added to your auth_user table to > identify which c

[web2py] Re: smartgrid - limit dropdown menu items in edit form

2018-01-02 Thread Jim S
I'm assuming you have a company_id added to your auth_user table to identify which company a user belongs to. If that is correct, then I'd add the following ahead of the SQLFORM.smartgrid call db.offer.user_id.requires = IS_IN_DB(db(db.auth_user.company_id == auth.user .company_id), db.auth_use

[web2py] Re: smartgrid request

2017-09-24 Thread Anthony
Use the constraints argument, as described here: http://web2py.com/books/default/chapter/29/07/forms-and-validators#smartgrid-signature Anthony On Sunday, September 24, 2017 at 10:14:41 AM UTC-4, LC LC wrote: > > Hello, > > def index(): > records = > SQLFORM.smartgrid(dbvoy.voyageur,linked_

[web2py] Re: Smartgrid Styles

2017-09-11 Thread Anthony
Also, note the the grid is just a nested web2py server-side DOM object, so you can always manipulate it using the methods described here: http://web2py.com/books/default/chapter/29/05/the-views#Server-side-DOM-and-parsing. Anthony On Monday, September 11, 2017 at 10:20:21 AM UTC-4, Anthony wrot

[web2py] Re: Smartgrid Styles

2017-09-11 Thread Leandro Sebastian Salgueiro
Thanks Anthony! Le lundi 11 septembre 2017 16:20:21 UTC+2, Anthony a écrit : > > As noted here > , > > smartgrid takes the same arguments as grid. For customizing the grid, check > out > http://web2py.co

[web2py] Re: Smartgrid Styles

2017-09-11 Thread Anthony
As noted here , smartgrid takes the same arguments as grid. For customizing the grid, check out http://web2py.com/books/default/chapter/29/07/forms-and-validators#SQLFORM-grid (in particular, look at the "

[web2py] Re: smartgrid tampering with url in browser

2017-06-26 Thread T.R.Rajkumar
Yes, Anthony I did del session.auth in logout action and it working fine. Thanks for all the input. I thought I cannot use the grid without auth. But now because of your help the dependency has been removed and I am on my own authentication. Thanks again. -- Resources: - http://web2py.com - ht

[web2py] Re: smartgrid tampering with url in browser

2017-06-24 Thread Anthony
To remove items from the session, don't simply set their values to None. In that case, the key will remain in the session, simply with None stored as its value. Instead, to get rid of a given item completely, delete it: del session.auth Alternatively, you could change the condition: if not 'au

[web2py] Re: smartgrid tampering with url in browser

2017-06-24 Thread T.R.Rajkumar
Now I have ant\other small hitch. When I logout the action logout is called and redirect to login page. If I or another user logins in with the same browser window digital signature is not available in grid. If I close the browser window and open the browser and login _signature is available.

[web2py] Re: smartgrid tampering with url in browser

2017-06-23 Thread T.R.Rajkumar
Yes, perfect Anthony. Thanks a lot for forbearing with me. Anyway it is my pleasure to learn from the group. I put the above code in my login action as below. It is working perfectly. from gluon.storage import Storage from gluon.utils import web2py_uuid def login(): form = FORM(TABLE(

[web2py] Re: smartgrid tampering with url in browser

2017-06-23 Thread Anthony
On Friday, June 23, 2017 at 1:35:23 AM UTC-4, T.R.Rajkumar wrote: > > Anthony, When I comment out auth and in model amc/amc.py I add this > from gluon.storage import Storage > from gluon.utils import web2py_uuid > if not 'auth' in session: > session.auth = Storage(hmac_key=web2py_uuid()) > Try

[web2py] Re: smartgrid tampering with url in browser

2017-06-22 Thread T.R.Rajkumar
Anthony, When I comment out auth and in model amc/amc.py I add this from gluon.storage import Storage from gluon.utils import web2py_uuid if not 'auth' in session: session.auth = Storage(hmac_key=web2py_uuid()) Now the smartgrid lists the rows but when add or edit button is clicked I get not

[web2py] Re: smartgrid tampering with url in browser

2017-06-22 Thread Anthony
As far as I understand, you are not using Auth, so why are you defining auth = Auth(...) at all? Just get rid of that line. On Thursday, June 22, 2017 at 1:06:05 AM UTC-4, T.R.Rajkumar wrote: > > I put the below code in my model file amc.py > > from gluon.storage import Storage > from gluon.util

[web2py] Re: smartgrid tampering with url in browser

2017-06-22 Thread T.R.Rajkumar
If I am not defining auth the error does not appear, but the grid user_signature is not working. I am setting the hmac_key as mentioned in model amc.py. from gluon.storage import Storage from gluon.utils import web2py_uuid if not 'auth' in session: session.auth = Storage(hmac_key=web2py_uuid(

[web2py] Re: smartgrid tampering with url in browser

2017-06-21 Thread Dave S
On Wednesday, June 21, 2017 at 10:06:05 PM UTC-7, T.R.Rajkumar wrote: > > I put the below code in my model file amc.py > > from gluon.storage import Storage > from gluon.utils import web2py_uuid > if not 'auth' in session: > session.auth = Storage(hmac_key=web2py_uuid()) > > But now when in

[web2py] Re: smartgrid tampering with url in browser

2017-06-21 Thread T.R.Rajkumar
I put the below code in my model file amc.py from gluon.storage import Storage from gluon.utils import web2py_uuid if not 'auth' in session: session.auth = Storage(hmac_key=web2py_uuid()) But now when in run http://127.0.0.1:8000/web_ocms/amc/new_contract I get this error. Error ticket for

[web2py] Re: smartgrid tampering with url in browser

2017-06-21 Thread Anthony
The user_signature functionality expects auth.hmac_key in the session, so, you could add something like the following in a model file: from gluon.storage import Storage from gluon.utils import web2py_uuid if not 'auth' in session: session.auth = Storage(hmac_key=web2py_uuid()) Anthony On We

[web2py] Re: smartgrid tampering with url in browser

2017-06-21 Thread T.R.Rajkumar
Yes, Anthony now with user_signature = True prevents tampering of urls generated by smartgrid. This is when I use auth and signup and then call the grid. But in my app I am using custom login form with user credentials from a legacy table. Can I achieve the same result with custom login form? As

[web2py] Re: smartgrid tampering with url in browser

2017-06-20 Thread Anthony
Have you tried user_signature=True? On Tuesday, June 20, 2017 at 6:42:11 AM UTC-4, T.R.Rajkumar wrote: > > I have this page from the edit button of the child. > > http://127.0.0.1:8000/web_ocms/amc/new_contract/amc_master/amc_details.amc_id/17/edit/amc_details/10 > Here 17 is the id of the master

[web2py] Re: smartgrid links

2017-06-20 Thread T.R.Rajkumar
Thank you Anthony. I will do the same. -- 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

[web2py] Re: smartgrid links

2017-06-19 Thread Anthony
I don't think that is supported. You can instead use server-side DOM manipulation to remove the unwanted DOM elements after the grid is created (or hide them via Javascript). Anthony On Wednesday, June 14,

[web2py] Re: smartgrid links

2017-06-19 Thread T.R.Rajkumar
Am I not clear in my question? -- 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] Re: Smartgrid, grid export control works on Linux, but not on Windows Server

2017-06-09 Thread Seth J
Yes, two versions are different. It seems to be the culprit here. Linux has a 2.13.3 version (I think I mentioned it above somewhere). IIS has the latest 2.14.5 on it. Thanks! On Friday, June 9, 2017 at 7:01:14 PM UTC-4, Anthony wrote: > > On Friday, June 9, 2017 at 4:03:09 PM UTC-4, Seth

[web2py] Re: Smartgrid, grid export control works on Linux, but not on Windows Server

2017-06-09 Thread Anthony
On Friday, June 9, 2017 at 4:03:09 PM UTC-4, Seth J wrote: > > As a matter of fact, I've never specified a table for export control on > any of my other apps written from scratch even on IIS and never had a > problem. It's just that particular app, for some reason, requires table > name. > No,

[web2py] Re: Smartgrid, grid export control works on Linux, but not on Windows Server

2017-06-09 Thread Seth J
As a matter of fact, I've never specified a table for export control on any of my other apps written from scratch even on IIS and never had a problem. It's just that particular app, for some reason, requires table name. On Friday, June 9, 2017 at 3:49:12 PM UTC-4, Anthony wrote: > > Hmm, though

[web2py] Re: Smartgrid, grid export control works on Linux, but not on Windows Server

2017-06-09 Thread Seth J
It IS exactly the same! It controlled export just fine with the attached code on Linux, but did NOT on Win IIS. It is still a mystery to me and, apparently, Jim. On Friday, June 9, 2017 at 3:49:12 PM UTC-4, Anthony wrote: > > Hmm, thought you said you were running the exact same code on both ser

[web2py] Re: Smartgrid, grid export control works on Linux, but not on Windows Server

2017-06-09 Thread Anthony
Hmm, thought you said you were running the exact same code on both servers as well as in new apps on the Windows server, and the only thing that wasn't working was the packed app moved from Linux to Windows. But looks like your code itself is wrong, so must not have been the same in the other a

[web2py] Re: Smartgrid, grid export control works on Linux, but not on Windows Server

2017-06-09 Thread Jim S
Glad to hear. Doesn't answer the question of why it is different between windows and linux, but does get it working. Have a great weekend. -Jim On Friday, June 9, 2017 at 1:47:20 PM UTC-5, Seth J wrote: > > My bad!!! I thought you were referencing my code there! Thanks a lot!!! > That solved

[web2py] Re: Smartgrid, grid export control works on Linux, but not on Windows Server

2017-06-09 Thread Seth J
My bad!!! I thought you were referencing my code there! Thanks a lot!!! That solved the problem!!! 👍 On Friday, June 9, 2017 at 2:43:45 PM UTC-4, Jim S wrote: > > Sorry, I'm not sure what you're referencing... Can you give me a line > number in default.py? > > -Jim > > On Friday, June 9, 2017

[web2py] Re: Smartgrid, grid export control works on Linux, but not on Windows Server

2017-06-09 Thread Jim S
Sorry, I'm not sure what you're referencing... Can you give me a line number in default.py? -Jim On Friday, June 9, 2017 at 1:40:52 PM UTC-5, Seth J wrote: > > Can you be more specific? I thought "title=dict(..." is reference > enough?!?! 🤔 > > On Friday, June 9, 2017 at 2:37:20 PM UTC-4, Jim

[web2py] Re: Smartgrid, grid export control works on Linux, but not on Windows Server

2017-06-09 Thread Seth J
Can you be more specific? I thought "title=dict(..." is reference enough?!?! 🤔 On Friday, June 9, 2017 at 2:37:20 PM UTC-4, Jim S wrote: > > You need to tell it which table you're referencing: > > title_grid = SQLFORM.smartgrid(db.title, linked_tables=['title_archive'], > links=title_links, >

[web2py] Re: Smartgrid, grid export control works on Linux, but not on Windows Server

2017-06-09 Thread Jim S
You need to tell it which table you're referencing: title_grid = SQLFORM.smartgrid(db.title, linked_tables=['title_archive'], links=title_links, editable=dict(title=True, title_archive=False), deletable=dict(title=True, title_archive=F

[web2py] Re: Smartgrid, grid export control works on Linux, but not on Windows Server

2017-06-08 Thread Anthony
You don't have to share the actual app, just create a minimal application that reproduces the problem. On Thursday, June 8, 2017 at 4:44:11 PM UTC-4, Seth J wrote: > > I wish I could do that, but it's government code. Security issues, etc. > I was just inquiring on how one would troubleshoot s

[web2py] Re: Smartgrid, grid export control works on Linux, but not on Windows Server

2017-06-08 Thread Seth J
I wish I could do that, but it's government code. Security issues, etc. I was just inquiring on how one would troubleshoot something like that?!?! May be it's related to a theme somehow?!?! On Thursday, June 8, 2017 at 8:38:52 AM UTC-4, Anthony wrote: > > If you'd like, feel free to attach a

[web2py] Re: Smartgrid, grid export control works on Linux, but not on Windows Server

2017-06-08 Thread Anthony
If you'd like, feel free to attach a packed app that exhibits this behavior (it should use SQLite as the db). On Thursday, June 8, 2017 at 8:20:24 AM UTC-4, Anthony wrote: > > So, (a) on Linux, the export buttons are properly hidden, (b) on Windows, > if you create a new app, again, the export b

[web2py] Re: Smartgrid, grid export control works on Linux, but not on Windows Server

2017-06-08 Thread Anthony
So, (a) on Linux, the export buttons are properly hidden, (b) on Windows, if you create a new app, again, the export buttons are properly hidden, but (c) if you pack an app from Linux and simply copy it to Windows, the export buttons that were hidden on Linux suddenly appear on Windows? I can't

[web2py] Re: Smartgrid, grid export control works on Linux, but not on Windows Server

2017-06-07 Thread Seth J
Neah, I never compile my apps for that very reason. -- 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 t

[web2py] Re: Smartgrid, grid export control works on Linux, but not on Windows Server

2017-06-07 Thread Anthony
Did you compile the app? If so, after making changes you must re-compile, as changes you make to the source files will otherwise have no effect. Anthony -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.goog

[web2py] Re: Smartgrid, grid export control works on Linux, but not on Windows Server

2017-06-07 Thread Seth J
That's the thing! There's no difference in my code, apart from connecting to different database. Controller and view are exactly the same. Same behavior is exhibited by all other controllers/views (about 10 in total). I am not saying that there's an error in framework. Apps created on Win Server

[web2py] Re: Smartgrid, grid export control works on Linux, but not on Windows Server

2017-06-07 Thread Anthony
There's nothing in the relevant framework code that would cause different behavior based on the OS or web server, so likely there is some other difference in your app code between the two systems. Anthony On Wednesday, June 7, 2017 at 4:41:38 PM UTC-4, Seth J wrote: > > I am experiencing a pecu

[web2py] Re: smartgrid edit form javascript calculation

2017-06-02 Thread Dave S
On Friday, June 2, 2017 at 4:00:54 AM UTC-7, T.R.Rajkumar wrote: > > Sorry. I am able to do it. In view new_contract.html I have now this. > I'm happy to hear that you've figured it out! -d > {{extend 'layout.html'}} > New Contract > {{=form}} > >