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 <atayl...@gmail.com <javascript:>>: > >> 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 <javascript:>. >> 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.