[web2py] create a link SQLFORM to another table with id.belongs
I have two tables: table1 & table 2 I compare table 2 events against table 1 and if it matches I insert it into table 2's field called "table2.table1_id" table2.table1_id has thousands of rows that have the row id of table 1 in it in the form of a list. Normally I could use the belongs feature, but I'm having a hard time getting it to work in the form of a link. Any thoughts on how I could do this? -- 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-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] create a link SQLFORM to another table with id.belongs
I use this: grid for table1 def index(): return dict(grid=SQLFORM.grid(Almoxarifado, links = [lambda row: A('Listar Objetos',_href=URL('objeto','index',args=[row.id]))], user_signature=False, csv=False)) grid for table2 def index(): if (not request.args) and (not request.vars): redirect(URL('almoxarifado','index')) alm = None if request.args: alm = request.args(0) try: if alm: alm = int(alm) session.almoxarifado=alm session.nomealmox = Almoxarifado[alm].nome except ValueError: pass Objeto.almoxarifado_id.default = session.almoxarifado form = SQLFORM.grid(Objeto.almoxarifado_id == session.almoxarifado, fields=[Objeto.nome, Objeto.quantidade, Objeto.localizacao], user_signature=False, csv=False) return dict(form=form, nome=session.nomealmox) -- 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-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] create a link SQLFORM to another table with id.belongs
This doesn't seem to work for me Fabiano, When I click the button it just keeps table1 on the screen. There has got to be an easier way (I hope) On Thursday, June 5, 2014 7:41:51 PM UTC-4, Fabiano Almeida wrote: > > I use this: > > grid for table1 > def index(): > return dict(grid=SQLFORM.grid(Almoxarifado, links = [lambda row: > A('Listar Objetos',_href=URL('objeto','index',args=[row.id]))], > user_signature=False, csv=False)) > > grid for table2 > def index(): > if (not request.args) and (not request.vars): > redirect(URL('almoxarifado','index')) > alm = None > if request.args: alm = request.args(0) > try: > if alm: > alm = int(alm) > session.almoxarifado=alm > session.nomealmox = Almoxarifado[alm].nome > except ValueError: > pass > Objeto.almoxarifado_id.default = session.almoxarifado > form = SQLFORM.grid(Objeto.almoxarifado_id == session.almoxarifado, > fields=[Objeto.nome, Objeto.quantidade, Objeto.localizacao], > user_signature=False, csv=False) > return dict(form=form, nome=session.nomealmox) > > -- 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-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] create a link SQLFORM to another table with id.belongs
SQLFORM isn't working for me with new_table = db(db.table1.id.belongs(record_ids)).select() if I do {{=new_table}} in my view I can see the records which belong to record_ids, but if I do: SQLFORM.grid(new_table) return dict(grid=grid) I get an error 'Rows' object has no attribute '_db' -- 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-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] create a link SQLFORM to another table with id.belongs
Hi, You send var grid (see: return dict(grid=grid)). The first var grid is a send var to your view, de second var grid is a local var of your function. Then, in controller use: grid = SQLFORM.grid(db.new_table) return dict(grid=grid) in the view use: {{=grid}} Fabiano. 2014-06-06 12:45 GMT-03:00 LoveWeb2py : > SQLFORM isn't working for me with > > > new_table = db(db.table1.id.belongs(record_ids)).select() > if I do {{=new_table}} in my view I can see the records which belong to > record_ids, but if I do: > > SQLFORM.grid(new_table) > return dict(grid=grid) > > > I get an error 'Rows' object has no attribute '_db' > > -- > 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-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to web2py+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- 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-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] create a link SQLFORM to another table with id.belongs
Hi Fabiano, I actually was already using grid= SQLFORM.grid(db.new_table). That is when I get the error. If I do grid='' to test it and just return the table without SQLFORM I can see it in the view, but when I apply SQLFORM I get the error 'Rows' object has no attribute '_db'. I'm guessing this is because of the way SQLFORM handles the grid? Could there be something in my model messing it up? On Friday, June 6, 2014 12:02:05 PM UTC-4, Fabiano Almeida wrote: > > Hi, > > You send var grid (see: return dict(grid=grid)). The first var grid is a > send var to your view, de second var grid is a local var of your function. > > Then, > in controller use: > grid = SQLFORM.grid(db.new_table) > return dict(grid=grid) > > in the view use: > {{=grid}} > > Fabiano. > > > 2014-06-06 12:45 GMT-03:00 LoveWeb2py >: > >> SQLFORM isn't working for me with >> >> >> new_table = db(db.table1.id.belongs(record_ids)).select() >> if I do {{=new_table}} in my view I can see the records which belong to >> record_ids, but if I do: >> >> SQLFORM.grid(new_table) >> return dict(grid=grid) >> >> >> I get an error 'Rows' object has no attribute '_db' >> >> -- >> 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-users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to web2py+un...@googlegroups.com . >> For more options, visit https://groups.google.com/d/optout. >> > > -- 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-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] create a link SQLFORM to another table with id.belongs
Try: grid = SQLFORM.grid(db.table, user_signature=False) Em sexta-feira, 6 de junho de 2014 13h10min34s UTC-3, LoveWeb2py escreveu: > > Hi Fabiano, > > I actually was already using grid= SQLFORM.grid(db.new_table). That is > when I get the error. > > If I do grid='' to test it and just return the table without SQLFORM I can > see it in the view, but when I apply SQLFORM I get the error 'Rows' object > has no attribute '_db'. > > I'm guessing this is because of the way SQLFORM handles the grid? Could > there be something in my model messing it up? > > On Friday, June 6, 2014 12:02:05 PM UTC-4, Fabiano Almeida wrote: >> >> Hi, >> >> You send var grid (see: return dict(grid=grid)). The first var grid is a >> send var to your view, de second var grid is a local var of your >> function. >> >> Then, >> in controller use: >> grid = SQLFORM.grid(db.new_table) >> return dict(grid=grid) >> >> in the view use: >> {{=grid}} >> >> Fabiano. >> >> >> 2014-06-06 12:45 GMT-03:00 LoveWeb2py : >> >>> SQLFORM isn't working for me with >>> >>> >>> new_table = db(db.table1.id.belongs(record_ids)).select() >>> if I do {{=new_table}} in my view I can see the records which belong to >>> record_ids, but if I do: >>> >>> SQLFORM.grid(new_table) >>> return dict(grid=grid) >>> >>> >>> I get an error 'Rows' object has no attribute '_db' >>> >>> -- >>> 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-users" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to web2py+un...@googlegroups.com. >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> -- 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-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] create a link SQLFORM to another table with id.belongs
How do you define tables? 2014-06-06 14:03 GMT-03:00 Fabiano Almeida : > Try: > > grid = SQLFORM.grid(db.table, user_signature=False) > > Em sexta-feira, 6 de junho de 2014 13h10min34s UTC-3, LoveWeb2py escreveu: > >> Hi Fabiano, >> >> I actually was already using grid= SQLFORM.grid(db.new_table). That is >> when I get the error. >> >> If I do grid='' to test it and just return the table without SQLFORM I >> can see it in the view, but when I apply SQLFORM I get the error 'Rows' >> object has no attribute '_db'. >> >> I'm guessing this is because of the way SQLFORM handles the grid? Could >> there be something in my model messing it up? >> >> On Friday, June 6, 2014 12:02:05 PM UTC-4, Fabiano Almeida wrote: >>> >>> Hi, >>> >>> You send var grid (see: return dict(grid=grid)). The first var grid is >>> a send var to your view, de second var grid is a local var of your >>> function. >>> >>> Then, >>> in controller use: >>> grid = SQLFORM.grid(db.new_table) >>> return dict(grid=grid) >>> >>> in the view use: >>> {{=grid}} >>> >>> Fabiano. >>> >>> >>> 2014-06-06 12:45 GMT-03:00 LoveWeb2py : >>> SQLFORM isn't working for me with new_table = db(db.table1.id.belongs(record_ids)).select() if I do {{=new_table}} in my view I can see the records which belong to record_ids, but if I do: SQLFORM.grid(new_table) return dict(grid=grid) I get an error 'Rows' object has no attribute '_db' -- 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-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. >>> >>> -- > 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-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to web2py+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- 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-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] create a link SQLFORM to another table with id.belongs
That was it! THANK YOU! Why does it work without a signature though? On Friday, June 6, 2014 1:03:35 PM UTC-4, Fabiano Almeida wrote: > > Try: > > grid = SQLFORM.grid(db.table, user_signature=False) > > Em sexta-feira, 6 de junho de 2014 13h10min34s UTC-3, LoveWeb2py escreveu: >> >> Hi Fabiano, >> >> I actually was already using grid= SQLFORM.grid(db.new_table). That is >> when I get the error. >> >> If I do grid='' to test it and just return the table without SQLFORM I >> can see it in the view, but when I apply SQLFORM I get the error 'Rows' >> object has no attribute '_db'. >> >> I'm guessing this is because of the way SQLFORM handles the grid? Could >> there be something in my model messing it up? >> >> On Friday, June 6, 2014 12:02:05 PM UTC-4, Fabiano Almeida wrote: >>> >>> Hi, >>> >>> You send var grid (see: return dict(grid=grid)). The first var grid is >>> a send var to your view, de second var grid is a local var of your >>> function. >>> >>> Then, >>> in controller use: >>> grid = SQLFORM.grid(db.new_table) >>> return dict(grid=grid) >>> >>> in the view use: >>> {{=grid}} >>> >>> Fabiano. >>> >>> >>> 2014-06-06 12:45 GMT-03:00 LoveWeb2py : >>> SQLFORM isn't working for me with new_table = db(db.table1.id.belongs(record_ids)).select() if I do {{=new_table}} in my view I can see the records which belong to record_ids, but if I do: SQLFORM.grid(new_table) return dict(grid=grid) I get an error 'Rows' object has no attribute '_db' -- 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-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. >>> >>> -- 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-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] create a link SQLFORM to another table with id.belongs
Are you logged in your app? 2014-06-06 14:07 GMT-03:00 LoveWeb2py : > That was it! THANK YOU! Why does it work without a signature though? > > > On Friday, June 6, 2014 1:03:35 PM UTC-4, Fabiano Almeida wrote: >> >> Try: >> >> grid = SQLFORM.grid(db.table, user_signature=False) >> >> Em sexta-feira, 6 de junho de 2014 13h10min34s UTC-3, LoveWeb2py escreveu: >>> >>> Hi Fabiano, >>> >>> I actually was already using grid= SQLFORM.grid(db.new_table). That is >>> when I get the error. >>> >>> If I do grid='' to test it and just return the table without SQLFORM I >>> can see it in the view, but when I apply SQLFORM I get the error 'Rows' >>> object has no attribute '_db'. >>> >>> I'm guessing this is because of the way SQLFORM handles the grid? Could >>> there be something in my model messing it up? >>> >>> On Friday, June 6, 2014 12:02:05 PM UTC-4, Fabiano Almeida wrote: Hi, You send var grid (see: return dict(grid=grid)). The first var grid is a send var to your view, de second var grid is a local var of your function. Then, in controller use: grid = SQLFORM.grid(db.new_table) return dict(grid=grid) in the view use: {{=grid}} Fabiano. 2014-06-06 12:45 GMT-03:00 LoveWeb2py : > SQLFORM isn't working for me with > > > new_table = db(db.table1.id.belongs(record_ids)).select() > if I do {{=new_table}} in my view I can see the records which belong > to record_ids, but if I do: > > SQLFORM.grid(new_table) > return dict(grid=grid) > > > I get an error 'Rows' object has no attribute '_db' > > -- > 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-users" group. > To unsubscribe from this group and stop receiving emails from it, send > an email to web2py+un...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- > 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-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to web2py+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- 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-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] create a link SQLFORM to another table with id.belongs
yes On Fri, Jun 6, 2014 at 1:09 PM, Fabiano Almeida wrote: > Are you logged in your app? > > > 2014-06-06 14:07 GMT-03:00 LoveWeb2py : > >> That was it! THANK YOU! Why does it work without a signature though? >> >> >> On Friday, June 6, 2014 1:03:35 PM UTC-4, Fabiano Almeida wrote: >>> >>> Try: >>> >>> grid = SQLFORM.grid(db.table, user_signature=False) >>> >>> Em sexta-feira, 6 de junho de 2014 13h10min34s UTC-3, LoveWeb2py >>> escreveu: Hi Fabiano, I actually was already using grid= SQLFORM.grid(db.new_table). That is when I get the error. If I do grid='' to test it and just return the table without SQLFORM I can see it in the view, but when I apply SQLFORM I get the error 'Rows' object has no attribute '_db'. I'm guessing this is because of the way SQLFORM handles the grid? Could there be something in my model messing it up? On Friday, June 6, 2014 12:02:05 PM UTC-4, Fabiano Almeida wrote: > > Hi, > > You send var grid (see: return dict(grid=grid)). The first var grid > is a send var to your view, de second var grid is a local var of your > function. > > Then, > in controller use: > grid = SQLFORM.grid(db.new_table) > return dict(grid=grid) > > in the view use: > {{=grid}} > > Fabiano. > > > 2014-06-06 12:45 GMT-03:00 LoveWeb2py : > >> SQLFORM isn't working for me with >> >> >> new_table = db(db.table1.id.belongs(record_ids)).select() >> if I do {{=new_table}} in my view I can see the records which belong >> to record_ids, but if I do: >> >> SQLFORM.grid(new_table) >> return dict(grid=grid) >> >> >> I get an error 'Rows' object has no attribute '_db' >> >> -- >> 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-users" group. >> To unsubscribe from this group and stop receiving emails from it, >> send an email to web2py+un...@googlegroups.com. >> For more options, visit https://groups.google.com/d/optout. >> > > -- >> 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-users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to web2py+unsubscr...@googlegroups.com. >> >> For more options, visit https://groups.google.com/d/optout. >> > > -- > 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 a topic in the > Google Groups "web2py-users" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/web2py/I8aGvbVcQxk/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > web2py+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- 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-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] create a link SQLFORM to another table with id.belongs
Now I get this error when I try to click edit on the query database: invalid literal for int() with base 10: 'edit' I've tried changing signature to false, but I don't think thats the problem. On Friday, June 6, 2014 1:17:39 PM UTC-4, LoveWeb2py wrote: > > yes > > > On Fri, Jun 6, 2014 at 1:09 PM, Fabiano Almeida > wrote: > >> Are you logged in your app? >> >>> >>> >>> On Friday, June 6, 2014 1:03:35 PM UTC-4, Fabiano Almeida wrote: Try: grid = SQLFORM.grid(db.table, user_signature=False) Em sexta-feira, 6 de junho de 2014 13h10min34s UTC-3, LoveWeb2py escreveu: > > Hi Fabiano, > > I actually was already using grid= SQLFORM.grid(db.new_table). That is > when I get the error. > > If I do grid='' to test it and just return the table without SQLFORM I > can see it in the view, but when I apply SQLFORM I get the error 'Rows' > object has no attribute '_db'. > > I'm guessing this is because of the way SQLFORM handles the grid? > Could there be something in my model messing it up? > > On Friday, June 6, 2014 12:02:05 PM UTC-4, Fabiano Almeida wrote: >> >> Hi, >> >> You send var grid (see: return dict(grid=grid)). The first var grid >> is a send var to your view, de second var grid is a local var of >> your function. >> >> Then, >> in controller use: >> grid = SQLFORM.grid(db.new_table) >> return dict(grid=grid) >> >> in the view use: >> {{=grid}} >> >> Fabiano. >> >> >> 2014-06-06 12:45 GMT-03:00 LoveWeb2py : >> >>> SQLFORM isn't working for me with >>> >>> >>> new_table = db(db.table1.id.belongs(record_ids)).select() >>> if I do {{=new_table}} in my view I can see the records which belong >>> to record_ids, but if I do: >>> >>> SQLFORM.grid(new_table) >>> return dict(grid=grid) >>> >>> >>> I get an error 'Rows' object has no attribute '_db' >>> >>> -- >>> 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-users" group. >>> To unsubscribe from this group and stop receiving emails from it, >>> send an email to web2py+un...@googlegroups.com. >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> -- >>> 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-users" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to web2py+unsubscr...@googlegroups.com. >>> >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> -- >> 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 a topic in the >> Google Groups "web2py-users" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/web2py/I8aGvbVcQxk/unsubscribe. >> To unsubscribe from this group and all its topics, send an email to >> web2py+unsubscr...@googlegroups.com. >> For more options, visit https://groups.google.com/d/optout. >> > > -- 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-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] create a link SQLFORM to another table with id.belongs
Show your code 2014-06-06 15:18 GMT-03:00 LoveWeb2py : > Now I get this error when I try to click edit on the query database: > > invalid literal for int() with base 10: > 'edit' > > I've tried changing signature to false, but I don't think thats the > problem. > > > On Friday, June 6, 2014 1:17:39 PM UTC-4, LoveWeb2py wrote: > >> yes >> >> >> On Fri, Jun 6, 2014 at 1:09 PM, Fabiano Almeida >> wrote: >> >>> Are you logged in your app? >>> On Friday, June 6, 2014 1:03:35 PM UTC-4, Fabiano Almeida wrote: > > Try: > > grid = SQLFORM.grid(db.table, user_signature=False) > > Em sexta-feira, 6 de junho de 2014 13h10min34s UTC-3, LoveWeb2py > escreveu: >> >> Hi Fabiano, >> >> I actually was already using grid= SQLFORM.grid(db.new_table). That >> is when I get the error. >> >> If I do grid='' to test it and just return the table without SQLFORM >> I can see it in the view, but when I apply SQLFORM I get the error 'Rows' >> object has no attribute '_db'. >> >> I'm guessing this is because of the way SQLFORM handles the grid? >> Could there be something in my model messing it up? >> >> On Friday, June 6, 2014 12:02:05 PM UTC-4, Fabiano Almeida wrote: >>> >>> Hi, >>> >>> You send var grid (see: return dict(grid=grid)). The first var grid >>> is a send var to your view, de second var grid is a local var of >>> your function. >>> >>> Then, >>> in controller use: >>> grid = SQLFORM.grid(db.new_table) >>> return dict(grid=grid) >>> >>> in the view use: >>> {{=grid}} >>> >>> Fabiano. >>> >>> >>> 2014-06-06 12:45 GMT-03:00 LoveWeb2py : >>> SQLFORM isn't working for me with new_table = db(db.table1.id.belongs(record_ids)).select() if I do {{=new_table}} in my view I can see the records which belong to record_ids, but if I do: SQLFORM.grid(new_table) return dict(grid=grid) I get an error 'Rows' object has no attribute '_db' -- 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-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. >>> >>> -- 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-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. >>> >>> -- >>> 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 a topic in the >>> Google Groups "web2py-users" group. >>> To unsubscribe from this topic, visit https://groups.google.com/d/ >>> topic/web2py/I8aGvbVcQxk/unsubscribe. >>> To unsubscribe from this group and all its topics, send an email to >>> web2py+unsubscr...@googlegroups.com. >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> -- > 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-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to web2py+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- 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-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] create a link SQLFORM to another table with id.belongs
invalid literal for int() with base 10: 'edit' In some part of your code has converting string to numeric type. Probably you should be picking up the URL argument and doing the conversion, but when you edit the registry of URL arguments are changed. In my example, I use session and try...except to resolve this. 2014-06-06 15:29 GMT-03:00 Fabiano Almeida : > Show your code > > > 2014-06-06 15:18 GMT-03:00 LoveWeb2py : > > Now I get this error when I try to click edit on the query database: >> >> invalid literal for int() with base 10: >> 'edit' >> >> I've tried changing signature to false, but I don't think thats the >> problem. >> >> >> On Friday, June 6, 2014 1:17:39 PM UTC-4, LoveWeb2py wrote: >> >>> yes >>> >>> >>> On Fri, Jun 6, 2014 at 1:09 PM, Fabiano Almeida >>> wrote: >>> Are you logged in your app? > > > On Friday, June 6, 2014 1:03:35 PM UTC-4, Fabiano Almeida wrote: >> >> Try: >> >> grid = SQLFORM.grid(db.table, user_signature=False) >> >> Em sexta-feira, 6 de junho de 2014 13h10min34s UTC-3, LoveWeb2py >> escreveu: >>> >>> Hi Fabiano, >>> >>> I actually was already using grid= SQLFORM.grid(db.new_table). That >>> is when I get the error. >>> >>> If I do grid='' to test it and just return the table without SQLFORM >>> I can see it in the view, but when I apply SQLFORM I get the error >>> 'Rows' >>> object has no attribute '_db'. >>> >>> I'm guessing this is because of the way SQLFORM handles the grid? >>> Could there be something in my model messing it up? >>> >>> On Friday, June 6, 2014 12:02:05 PM UTC-4, Fabiano Almeida wrote: Hi, You send var grid (see: return dict(grid=grid)). The first var grid is a send var to your view, de second var grid is a local var of your function. Then, in controller use: grid = SQLFORM.grid(db.new_table) return dict(grid=grid) in the view use: {{=grid}} Fabiano. 2014-06-06 12:45 GMT-03:00 LoveWeb2py : > SQLFORM isn't working for me with > > > new_table = db(db.table1.id.belongs(record_ids)).select() > if I do {{=new_table}} in my view I can see the records which > belong to record_ids, but if I do: > > SQLFORM.grid(new_table) > return dict(grid=grid) > > > I get an error 'Rows' object has no attribute '_db' > > -- > 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-users" group. > To unsubscribe from this group and stop receiving emails from it, > send an email to web2py+un...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- > 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-users" group. > To unsubscribe from this group and stop receiving emails from it, send > an email to web2py+unsubscr...@googlegroups.com. > > For more options, visit https://groups.google.com/d/optout. > -- 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 a topic in the Google Groups "web2py-users" group. To unsubscribe from this topic, visit https://groups.google.com/d/ topic/web2py/I8aGvbVcQxk/unsubscribe. To unsubscribe from this group and all its topics, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. >>> >>> -- >> 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-users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to web2py+unsubscr...@googlegroups.com. >> For more options, visit https://groups.google.com/d/optout. >> > > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http:/
Re: [web2py] create a link SQLFORM to another table with id.belongs
Hi Fabiano, Thank you for your reply. What do you mean by *"edit the registry of URL arguments are changed. "* Here is my code: def query_table2(): table2_records = [] table1_inv_record = request.args(0) row = db(db.table1.id==table1_inv_record).select() for line in row: joined_records = line.inv_id query=db.table1.id.belongs(joined_records) grid=SQLFORM.grid(query, user_signature=False) return dict(grid=grid) view for query_table2.html: {{=grid}} On Friday, June 6, 2014 3:43:12 PM UTC-4, Fabiano Almeida wrote: > > invalid literal for int() with base 10: > 'edit' > > In some part of your code has converting string to numeric type. Probably > you should be picking up the URL argument and doing the conversion, but > when you edit the registry of URL arguments are changed. > > In my example, I use session and try...except to resolve this. > > > > 2014-06-06 15:29 GMT-03:00 Fabiano Almeida >: > >> Show your code >> >> >> 2014-06-06 15:18 GMT-03:00 LoveWeb2py >: >> >> Now I get this error when I try to click edit on the query database: >>> >>> invalid literal for int() with base 10: >>> 'edit' >>> >>> I've tried changing signature to false, but I don't think thats the >>> problem. >>> >>> >>> On Friday, June 6, 2014 1:17:39 PM UTC-4, LoveWeb2py wrote: >>> yes On Fri, Jun 6, 2014 at 1:09 PM, Fabiano Almeida >>> > wrote: > Are you logged in your app? > >> >> >> On Friday, June 6, 2014 1:03:35 PM UTC-4, Fabiano Almeida wrote: >>> >>> Try: >>> >>> grid = SQLFORM.grid(db.table, user_signature=False) >>> >>> Em sexta-feira, 6 de junho de 2014 13h10min34s UTC-3, LoveWeb2py >>> escreveu: Hi Fabiano, I actually was already using grid= SQLFORM.grid(db.new_table). That is when I get the error. If I do grid='' to test it and just return the table without SQLFORM I can see it in the view, but when I apply SQLFORM I get the error 'Rows' object has no attribute '_db'. I'm guessing this is because of the way SQLFORM handles the grid? Could there be something in my model messing it up? On Friday, June 6, 2014 12:02:05 PM UTC-4, Fabiano Almeida wrote: > > Hi, > > You send var grid (see: return dict(grid=grid)). The first var > grid is a send var to your view, de second var grid is a local > var of your function. > > Then, > in controller use: > grid = SQLFORM.grid(db.new_table) > return dict(grid=grid) > > in the view use: > {{=grid}} > > Fabiano. > > > 2014-06-06 12:45 GMT-03:00 LoveWeb2py : > >> SQLFORM isn't working for me with >> >> >> new_table = db(db.table1.id.belongs(record_ids)).select() >> if I do {{=new_table}} in my view I can see the records which >> belong to record_ids, but if I do: >> >> SQLFORM.grid(new_table) >> return dict(grid=grid) >> >> >> I get an error 'Rows' object has no attribute '_db' >> >> -- >> 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-users" group. >> To unsubscribe from this group and stop receiving emails from it, >> send an email to web2py+un...@googlegroups.com. >> For more options, visit https://groups.google.com/d/optout. >> > > -- >> 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-users" group. >> To unsubscribe from this group and stop receiving emails from it, >> send an email to web2py+un...@googlegroups.com . >> >> For more options, visit https://groups.google.com/d/optout. >> > > -- > 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 a topic in the > Google Groups "web2py-users" group. > To unsubscribe from this topic, visit https://groups.google.com/d/ > topic/web2py/I8aGvbVcQxk/unsubscribe. > To unsubscribe from this group and all its topics, send
Re: [web2py] create a link SQLFORM to another table with id.belongs
Hi, Sorry for my poor english, by lazy, sometimes I use google translate (portuguese -> english), and don't check the translation. table1_inv_record = request.args(0) In this line you get de first args, but on click to edit record in grid, the function it's called again and url change args, then first args in url is 'edit', and this is literal, not numerical. row = db(db.table1.id==table1_inv_record).select() In edit mode (and changed url), get error because var table1_inv_record is not numerical at this time. I think this is a line in your traceback error. So I use try...except block to convert first arg in integer, if ok, use session to store de right id sent in the original url. > alm = None # this is for prevent error case haven't args(0) > if request.args: alm = request.args(0) > try: > if alm: > alm = int(alm) > *session.almoxarifado*=alm# this line executes only if the > previous line no error > except ValueError: > pass > Objeto.almoxarifado_id.default = *session.almoxarifado* 2014-06-09 13:47 GMT-03:00 LoveWeb2py : > Hi Fabiano, > > Thank you for your reply. What do you mean by *"edit the registry of URL > arguments are changed. "* > > Here is my code: > def query_table2(): >table2_records = [] >table1_inv_record = request.args(0) >row = db(db.table1.id==table1_inv_record).select() >for line in row: > joined_records = line.inv_id >query=db.table1.id.belongs(joined_records) >grid=SQLFORM.grid(query, user_signature=False) >return dict(grid=grid) > > view for query_table2.html: >{{=grid}} > > > > On Friday, June 6, 2014 3:43:12 PM UTC-4, Fabiano Almeida wrote: > >> invalid literal for int() with base 10: >> 'edit' >> >> In some part of your code has converting string to numeric type. Probably >> you should be picking up the URL argument and doing the conversion, but >> when you edit the registry of URL arguments are changed. >> >> In my example, I use session and try...except to resolve this. >> >> >> >> 2014-06-06 15:29 GMT-03:00 Fabiano Almeida : >> >>> Show your code >>> >>> >>> 2014-06-06 15:18 GMT-03:00 LoveWeb2py : >>> >>> Now I get this error when I try to click edit on the query database: invalid literal for int() with base 10: 'edit' I've tried changing signature to false, but I don't think thats the problem. On Friday, June 6, 2014 1:17:39 PM UTC-4, LoveWeb2py wrote: > yes > > > On Fri, Jun 6, 2014 at 1:09 PM, Fabiano Almeida > wrote: > >> Are you logged in your app? >> >>> >>> >>> On Friday, June 6, 2014 1:03:35 PM UTC-4, Fabiano Almeida wrote: Try: grid = SQLFORM.grid(db.table, user_signature=False) Em sexta-feira, 6 de junho de 2014 13h10min34s UTC-3, LoveWeb2py escreveu: > > Hi Fabiano, > > I actually was already using grid= SQLFORM.grid(db.new_table). > That is when I get the error. > > If I do grid='' to test it and just return the table without > SQLFORM I can see it in the view, but when I apply SQLFORM I get the > error > 'Rows' object has no attribute '_db'. > > I'm guessing this is because of the way SQLFORM handles the grid? > Could there be something in my model messing it up? > > On Friday, June 6, 2014 12:02:05 PM UTC-4, Fabiano Almeida wrote: >> >> Hi, >> >> You send var grid (see: return dict(grid=grid)). The first var >> grid is a send var to your view, de second var grid is a local >> var of your function. >> >> Then, >> in controller use: >> grid = SQLFORM.grid(db.new_table) >> return dict(grid=grid) >> >> in the view use: >> {{=grid}} >> >> Fabiano. >> >> >> 2014-06-06 12:45 GMT-03:00 LoveWeb2py : >> >>> SQLFORM isn't working for me with >>> >>> >>> new_table = db(db.table1.id.belongs(record_ids)).select() >>> if I do {{=new_table}} in my view I can see the records which >>> belong to record_ids, but if I do: >>> >>> SQLFORM.grid(new_table) >>> return dict(grid=grid) >>> >>> >>> I get an error 'Rows' object has no attribute '_db' >>> >>> -- >>> 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-users" group. >>> To unsubscribe from this group and stop receiving emails from >>> it, send an email to web2py+un...@goo
Re: [web2py] create a link SQLFORM to another table with id.belongs
No problem at all and I appreciate you trying to respond to English. Is Object your table name and Almoxarifado_id is your id field in Objeto? Objeto.almoxarifado_id On Monday, June 9, 2014 1:30:49 PM UTC-4, Fabiano Almeida wrote: > > Hi, > > Sorry for my poor english, by lazy, sometimes I use google translate > (portuguese -> english), and don't check the translation. > > table1_inv_record = request.args(0) > > In this line you get de first args, but on click to edit record in grid, > the function it's called again and url change args, then first args in url > is 'edit', and this is literal, not numerical. > > row = db(db.table1.id==table1_inv_record).select() > > In edit mode (and changed url), get error because var table1_inv_record > is not numerical at this time. I think this is a line in your traceback > error. > > So I use try...except block to convert first arg in integer, if ok, use > session to store de right id sent in the original url. > >> alm = None # this is for prevent error case haven't args(0) >> if request.args: alm = request.args(0) >> try: >> if alm: >> alm = int(alm) >> *session.almoxarifado*=alm# this line executes only if the >> previous line no error >> except ValueError: >> pass >> Objeto.almoxarifado_id.default = *session.almoxarifado* > > > > > > > 2014-06-09 13:47 GMT-03:00 LoveWeb2py >: > >> Hi Fabiano, >> >> Thank you for your reply. What do you mean by *"edit the registry of URL >> arguments are changed. "* >> >> Here is my code: >> def query_table2(): >>table2_records = [] >>table1_inv_record = request.args(0) >>row = db(db.table1.id==table1_inv_record).select() >>for line in row: >> joined_records = line.inv_id >>query=db.table1.id.belongs(joined_records) >>grid=SQLFORM.grid(query, user_signature=False) >>return dict(grid=grid) >> >> view for query_table2.html: >>{{=grid}} >> >> >> >> On Friday, June 6, 2014 3:43:12 PM UTC-4, Fabiano Almeida wrote: >> >>> invalid literal for int() with base 10: >>> 'edit' >>> >>> In some part of your code has converting string to numeric type. >>> Probably you should be picking up the URL argument and doing the >>> conversion, but when you edit the registry of URL arguments are changed. >>> >>> In my example, I use session and try...except to resolve this. >>> >>> >>> >>> 2014-06-06 15:29 GMT-03:00 Fabiano Almeida : >>> Show your code 2014-06-06 15:18 GMT-03:00 LoveWeb2py : Now I get this error when I try to click edit on the query database: > > invalid literal for int() with base 10: > 'edit' > > I've tried changing signature to false, but I don't think thats the > problem. > > > On Friday, June 6, 2014 1:17:39 PM UTC-4, LoveWeb2py wrote: > >> yes >> >> >> On Fri, Jun 6, 2014 at 1:09 PM, Fabiano Almeida < >> fab...@techno7.com.br> wrote: >> >>> Are you logged in your app? >>> On Friday, June 6, 2014 1:03:35 PM UTC-4, Fabiano Almeida wrote: > > Try: > > grid = SQLFORM.grid(db.table, user_signature=False) > > Em sexta-feira, 6 de junho de 2014 13h10min34s UTC-3, LoveWeb2py > escreveu: >> >> Hi Fabiano, >> >> I actually was already using grid= SQLFORM.grid(db.new_table). >> That is when I get the error. >> >> If I do grid='' to test it and just return the table without >> SQLFORM I can see it in the view, but when I apply SQLFORM I get the >> error >> 'Rows' object has no attribute '_db'. >> >> I'm guessing this is because of the way SQLFORM handles the grid? >> Could there be something in my model messing it up? >> >> On Friday, June 6, 2014 12:02:05 PM UTC-4, Fabiano Almeida wrote: >>> >>> Hi, >>> >>> You send var grid (see: return dict(grid=grid)). The first var >>> grid is a send var to your view, de second var grid is a local >>> var of your function. >>> >>> Then, >>> in controller use: >>> grid = SQLFORM.grid(db.new_table) >>> return dict(grid=grid) >>> >>> in the view use: >>> {{=grid}} >>> >>> Fabiano. >>> >>> >>> 2014-06-06 12:45 GMT-03:00 LoveWeb2py : >>> SQLFORM isn't working for me with new_table = db(db.table1.id.belongs(record_ids)).select() if I do {{=new_table}} in my view I can see the records which belong to record_ids, but if I do: SQLFORM.grid(new_table) return dict(grid=grid) I get an error 'Rows' object has no attribute '_db' -- Resources: - http:
Re: [web2py] create a link SQLFORM to another table with id.belongs
Objeto it's the table almoxarifado_id it's a FK (reference field) 2014-06-09 14:48 GMT-03:00 LoveWeb2py : > No problem at all and I appreciate you trying to respond to English. > > Is Object your table name and Almoxarifado_id is your id field in Objeto? > > Objeto.almoxarifado_id > > > On Monday, June 9, 2014 1:30:49 PM UTC-4, Fabiano Almeida wrote: > >> Hi, >> >> Sorry for my poor english, by lazy, sometimes I use google translate >> (portuguese -> english), and don't check the translation. >> >> table1_inv_record = request.args(0) >> >> In this line you get de first args, but on click to edit record in grid, >> the function it's called again and url change args, then first args in url >> is 'edit', and this is literal, not numerical. >> >> row = db(db.table1.id==table1_inv_record).select() >> >> In edit mode (and changed url), get error because var table1_inv_record >> is not numerical at this time. I think this is a line in your traceback >> error. >> >> So I use try...except block to convert first arg in integer, if ok, use >> session to store de right id sent in the original url. >> >>> alm = None # this is for prevent error case haven't args(0) >>> if request.args: alm = request.args(0) >>> try: >>> if alm: >>> alm = int(alm) >>> *session.almoxarifado*=alm# this line executes only if >>> the previous line no error >>> except ValueError: >>> pass >>> Objeto.almoxarifado_id.default = *session.almoxarifado* >> >> >> >> >> >> >> 2014-06-09 13:47 GMT-03:00 LoveWeb2py : >> >> Hi Fabiano, >>> >>> Thank you for your reply. What do you mean by *"edit the registry of >>> URL arguments are changed. "* >>> >>> Here is my code: >>> def query_table2(): >>>table2_records = [] >>>table1_inv_record = request.args(0) >>>row = db(db.table1.id==table1_inv_record).select() >>>for line in row: >>> joined_records = line.inv_id >>>query=db.table1.id.belongs(joined_records) >>>grid=SQLFORM.grid(query, user_signature=False) >>>return dict(grid=grid) >>> >>> view for query_table2.html: >>>{{=grid}} >>> >>> >>> >>> On Friday, June 6, 2014 3:43:12 PM UTC-4, Fabiano Almeida wrote: >>> invalid literal for int() with base 10: 'edit' In some part of your code has converting string to numeric type. Probably you should be picking up the URL argument and doing the conversion, but when you edit the registry of URL arguments are changed. In my example, I use session and try...except to resolve this. 2014-06-06 15:29 GMT-03:00 Fabiano Almeida : > Show your code > > > 2014-06-06 15:18 GMT-03:00 LoveWeb2py : > > Now I get this error when I try to click edit on the query database: >> >> invalid literal for int() with base >> 10: 'edit' >> >> I've tried changing signature to false, but I don't think thats the >> problem. >> >> >> On Friday, June 6, 2014 1:17:39 PM UTC-4, LoveWeb2py wrote: >> >>> yes >>> >>> >>> On Fri, Jun 6, 2014 at 1:09 PM, Fabiano Almeida < >>> fab...@techno7.com.br> wrote: >>> Are you logged in your app? > > > On Friday, June 6, 2014 1:03:35 PM UTC-4, Fabiano Almeida wrote: >> >> Try: >> >> grid = SQLFORM.grid(db.table, user_signature=False) >> >> Em sexta-feira, 6 de junho de 2014 13h10min34s UTC-3, LoveWeb2py >> escreveu: >>> >>> Hi Fabiano, >>> >>> I actually was already using grid= SQLFORM.grid(db.new_table). >>> That is when I get the error. >>> >>> If I do grid='' to test it and just return the table without >>> SQLFORM I can see it in the view, but when I apply SQLFORM I get >>> the error >>> 'Rows' object has no attribute '_db'. >>> >>> I'm guessing this is because of the way SQLFORM handles the >>> grid? Could there be something in my model messing it up? >>> >>> On Friday, June 6, 2014 12:02:05 PM UTC-4, Fabiano Almeida wrote: Hi, You send var grid (see: return dict(grid=grid)). The first var grid is a send var to your view, de second var grid is a local var of your function. Then, in controller use: grid = SQLFORM.grid(db.new_table) return dict(grid=grid) in the view use: {{=grid}} Fabiano. 2014-06-06 12:45 GMT-03:00 LoveWeb2py : > SQLFORM isn't working for me with > > > new_table = db(db.table1.id.belongs(record_ids)).select() > if I do {{=new_table}} in my view I can see the records which > belong to record_ids, but if I do: >>>
Re: [web2py] create a link SQLFORM to another table with id.belongs
Hi Fabiano, I'm still trying to get this For your Objeto.almoxarifado_id.default = session.almoxarifado Shouldn't there be a db.Objeto.almoxarifado_id ? If I try to just put table2.id I get an error saying table2 isn't defined. Here is what I have so far def query_table2(): table1_inv_record = None table2_records = [] table1_inv_record = request.args(0) row = db(db.table1.id==table1_inv_record).select() for line in row: joined_records = line.inv_id if table1_inv_record: inv1_record = int(table1_inv_record) session.table1_id = inv1_record query=db.table1.id.belongs(joined_records) db.table1.id.default = session.table1.id grid=SQLFORM.grid(query, user_signature=False) return dict(grid=grid) Still getting the same error though My db.model is like this: db.define_table('table2', Field('table1_inv_record', 'list:integer') -- 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-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] create a link SQLFORM to another table with id.belongs
def query_table2(): table1_inv_record = None table2_records = [] if request.args: try: session.table1_id = int(request.args(0)) except: pass row = db(db.table1.id==session.table1_id).select() for line in row: joined_records = line.inv_id query=db.table1.id.belongs(joined_records) db.table1.id.default = session.table1_id grid=SQLFORM.grid(query, user_signature=False) return dict(grid=grid) 2014-06-09 17:09 GMT-03:00 LoveWeb2py : > Hi Fabiano, > > I'm still trying to get this > > For your Objeto.almoxarifado_id.default = session.almoxarifado > > Shouldn't there be a db.Objeto.almoxarifado_id ? If I try to just put > table2.id I get an error saying table2 isn't defined. > > Here is what I have so far > > def query_table2(): >table1_inv_record = None > >table2_records = [] >table1_inv_record = request.args(0) >row = db(db.table1.id==table1_inv_record).select() >for line in row: > joined_records = line.inv_id >if table1_inv_record: > inv1_record = int(table1_inv_record) > session.table1_id = inv1_record >query=db.table1.id.belongs(joined_records) >db.table1.id.default = session.table1.id >grid=SQLFORM.grid(query, user_signature=False) >return dict(grid=grid) > > Still getting the same error though > > My db.model is like this: db.define_table('table2', > Field('table1_inv_record', 'list:integer') > > -- > 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-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to web2py+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- 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-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] create a link SQLFORM to another table with id.belongs
My db.py: Almoxarifado = db.define_table('almoxarifado', Field('name')) Objeto = db.define_table('objeto', Field('name'), Field('almoxarifado_id', db.almoxarifado)) Objeto.almoxarifado_id.requires=IS_IN_DB(db, 'almoxarifado.id', '%(nome)s') 2014-06-09 17:09 GMT-03:00 LoveWeb2py : > Hi Fabiano, > > I'm still trying to get this > > For your Objeto.almoxarifado_id.default = session.almoxarifado > > Shouldn't there be a db.Objeto.almoxarifado_id ? If I try to just put > table2.id I get an error saying table2 isn't defined. > > Here is what I have so far > > def query_table2(): >table1_inv_record = None > >table2_records = [] >table1_inv_record = request.args(0) >row = db(db.table1.id==table1_inv_record).select() >for line in row: > joined_records = line.inv_id >if table1_inv_record: > inv1_record = int(table1_inv_record) > session.table1_id = inv1_record >query=db.table1.id.belongs(joined_records) >db.table1.id.default = session.table1.id >grid=SQLFORM.grid(query, user_signature=False) >return dict(grid=grid) > > Still getting the same error though > > My db.model is like this: db.define_table('table2', > Field('table1_inv_record', 'list:integer') > > -- > 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-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to web2py+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- 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-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] create a link SQLFORM to another table with id.belongs
It's working! Thank you so much! I actually didn't need the db.table1.id.default = session.table1.id I think this was the line that fixed it: row = db(db.table1.id==session.table1_id).select() Thank you, thank you, thank you!! Such a huge help. Have a virtual beer on me :) Once On Monday, June 9, 2014 4:38:04 PM UTC-4, Fabiano Almeida wrote: > > My db.py: > > > Almoxarifado = db.define_table('almoxarifado', Field('name')) > > Objeto = db.define_table('objeto', Field('name'), Field('almoxarifado_id', > db.almoxarifado)) > Objeto.almoxarifado_id.requires=IS_IN_DB(db, 'almoxarifado.id', > '%(nome)s') > > > > 2014-06-09 17:09 GMT-03:00 LoveWeb2py >: > >> Hi Fabiano, >> >> I'm still trying to get this >> >> For your Objeto.almoxarifado_id.default = session.almoxarifado >> >> Shouldn't there be a db.Objeto.almoxarifado_id ? If I try to just put >> table2.id I get an error saying table2 isn't defined. >> >> Here is what I have so far >> >> def query_table2(): >>table1_inv_record = None >> >>table2_records = [] >>table1_inv_record = request.args(0) >>row = db(db.table1.id==table1_inv_record).select() >>for line in row: >> joined_records = line.inv_id >>if table1_inv_record: >> inv1_record = int(table1_inv_record) >> session.table1_id = inv1_record >>query=db.table1.id.belongs(joined_records) >>db.table1.id.default = session.table1.id >>grid=SQLFORM.grid(query, user_signature=False) >>return dict(grid=grid) >> >> Still getting the same error though >> >> My db.model is like this: db.define_table('table2', >> Field('table1_inv_record', 'list:integer') >> >> -- >> 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-users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to web2py+un...@googlegroups.com . >> For more options, visit https://groups.google.com/d/optout. >> > > -- 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-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] create a link SQLFORM to another table with id.belongs
Hi, Good! db.table1.id.default = session.table1.id > This line is used to insert new record automatically by SQLFORM. For the id field is unnecessary, it is useful when you want to set a default value, eg FK. All beers!! -- 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-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.