Re: [web2py] create a link SQLFORM to another table with id.belongs

2014-06-09 Thread 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:

Re: [web2py] create a link SQLFORM to another table with id.belongs

2014-06-09 Thread Fabiano Almeida
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

Re: [web2py] create a link SQLFORM to another table with id.belongs

2014-06-09 Thread 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

Re: [web2py] create a link SQLFORM to another table with id.belongs

2014-06-09 Thread Fabiano Almeida
Objeto it's the table almoxarifado_id it's a FK (reference field) 2014-06-09 14:48 GMT-03:00 LoveWeb2py atayloru...@gmail.com: 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?

Re: [web2py] create a link SQLFORM to another table with id.belongs

2014-06-09 Thread 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():

Re: [web2py] create a link SQLFORM to another table with id.belongs

2014-06-09 Thread Fabiano Almeida
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

Re: [web2py] create a link SQLFORM to another table with id.belongs

2014-06-09 Thread Fabiano Almeida
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

Re: [web2py] create a link SQLFORM to another table with id.belongs

2014-06-09 Thread LoveWeb2py
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,

Re: [web2py] create a link SQLFORM to another table with id.belongs

2014-06-09 Thread Fabiano Almeida
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

Re: [web2py] create a link SQLFORM to another table with id.belongs

2014-06-06 Thread 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'

Re: [web2py] create a link SQLFORM to another table with id.belongs

2014-06-06 Thread Fabiano Almeida
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

Re: [web2py] create a link SQLFORM to another table with id.belongs

2014-06-06 Thread LoveWeb2py
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

Re: [web2py] create a link SQLFORM to another table with id.belongs

2014-06-06 Thread 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

Re: [web2py] create a link SQLFORM to another table with id.belongs

2014-06-06 Thread Fabiano Almeida
How do you define tables? 2014-06-06 14:03 GMT-03:00 Fabiano Almeida fabi...@techno7.com.br: 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=

Re: [web2py] create a link SQLFORM to another table with id.belongs

2014-06-06 Thread 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

Re: [web2py] create a link SQLFORM to another table with id.belongs

2014-06-06 Thread Fabiano Almeida
Are you logged in your app? 2014-06-06 14:07 GMT-03:00 LoveWeb2py atayloru...@gmail.com: 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

Re: [web2py] create a link SQLFORM to another table with id.belongs

2014-06-06 Thread Austin Taylor
yes On Fri, Jun 6, 2014 at 1:09 PM, Fabiano Almeida fabi...@techno7.com.br wrote: Are you logged in your app? 2014-06-06 14:07 GMT-03:00 LoveWeb2py atayloru...@gmail.com: That was it! THANK YOU! Why does it work without a signature though? On Friday, June 6, 2014 1:03:35 PM UTC-4,

Re: [web2py] create a link SQLFORM to another table with id.belongs

2014-06-06 Thread LoveWeb2py
Now I get this error when I try to click edit on the query database: type 'exceptions.ValueError' 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

Re: [web2py] create a link SQLFORM to another table with id.belongs

2014-06-06 Thread Fabiano Almeida
Show your code 2014-06-06 15:18 GMT-03:00 LoveWeb2py atayloru...@gmail.com: Now I get this error when I try to click edit on the query database: type 'exceptions.ValueError' invalid literal for int() with base 10: 'edit' I've tried changing signature to false, but I don't think thats the

Re: [web2py] create a link SQLFORM to another table with id.belongs

2014-06-06 Thread Fabiano Almeida
type 'exceptions.ValueError' 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

[web2py] create a link SQLFORM to another table with id.belongs

2014-06-05 Thread LoveWeb2py
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

Re: [web2py] create a link SQLFORM to another table with id.belongs

2014-06-05 Thread Fabiano Almeida
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):

Re: [web2py] create a link SQLFORM to another table with id.belongs

2014-06-05 Thread LoveWeb2py
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