Re: [web2py] Re: Db fields in the "links" of the grid

2020-10-07 Thread Jim Steil
I will take a look tomorrow to see if I can code something up to reproduce the error. Which tackle are you setting as the 'primary' table, by that I mean what field are you specifying in the field_id parameter? And, is there ALWAYS a matching record in the secondary table? Oh, just thought of

Re: [web2py] Re: Db fields in the "links" of the grid

2020-10-07 Thread Eliezer (Vlad) Tseytkin
Jom, you said " I'm having trouble understanding why you need the try/except" - this is exactly the trouble I'm having too :) I do use the left join. So I should simply specify the table name - correct? Well, if I do - then the grid itself works fine, but once I click "view" or "edit" - it

Re: [web2py] Re: Db fields in the "links" of the grid

2020-10-07 Thread Jim S
I'm having trouble understanding why you need the try/except. To me it seems like "if you specify a left" -> you need to use the table name. "if you don't specify a left" -> omit the table name Do you have an occasion where sometimes different rows in the same grid require you to specify the

Re: [web2py] Re: Db fields in the "links" of the grid

2020-10-07 Thread Eliezer (Vlad) Tseytkin
But shouldn't it be the same for the grid and for the record of the grid? The difference confuses me - having to specify the table should be consistent when I use the grid for all the transactions of the grid, including view/edit etc.. In other words, having to specify the table is perfectly fine

Re: [web2py] Re: Db fields in the "links" of the grid

2020-10-07 Thread Jim Steil
I think that is a result of having a left join specified. With the left join you now have to specify which table the field is in as well. Or, am I missing something? -Jim On Wed, Oct 7, 2020 at 9:13 PM Eliezer (Vlad) Tseytkin < westgate6...@gmail.com> wrote: > Jim, > > Thank you for the

Re: [web2py] Re: Db fields in the "links" of the grid

2020-10-07 Thread Eliezer (Vlad) Tseytkin
Jim, Thank you for the suggestions. I do specify field_id (it wasn't there in the simplified code, but the complete code does have it). When I use a function, instead of the lambda, I indeed can have a solution, but at the same time it emphasizes that something is wrong: The links are now

[web2py] Re: Db fields in the "links" of the grid

2020-10-07 Thread Jim S
I have a couple of ideas, but none are tested First, can you try adding the field_id parameter to your SQLFORM.grid() call? I believe that tells this grid which is your 'primary' table. Secondly (this is the way I typically handle it) - instead of coding everything in a lambda, call a

[web2py] Db fields in the "links" of the grid

2020-10-07 Thread Vlad
Seems to me this is an inconsistency in the way how grid operates (which breaks it, as I show below, but, of course, most probably I am just missing something.) The following code crashes: query = db.cart fields = [db.cart.id] links = [dict(header='View', body=lambda row: