Hi guys,
I have a problem with syntax with Fk and don't know where it coming from :
Model and represent :
db.define_table('table1',
Field('table1_id','id'),
Field('field1','string',length=25),
format='%(field1)s')
db.define_table('table2',
Field('table2_id','id'),
Field('table1_id',db.table1),
Field('field2','string',length=25))
db.table2.table1_id.represent=lambda id: db.table1(id).field1
Controller :
def create_table1():
form = crud.create(db.table1)
return dict(form=form)
def create_table2():
form = crud.create(db.table2)
return dict(form=form)
def select_table2():
table = crud.select(db.table2)
return dict(table=table)
If I put some data in the table1 and then table2 and try to look at them
with select_table2 func. I can't have my table1_id represented...
In a old app I can use this syntax instead :
db.define_table('table2',
Field('table2_id','id'),
Field('table1_id','db.table1'),
Field('field2','string',length=25))
That create a ticket now in web2py 1.91.6 and 1.92.1. But in my old app in
bring me the representation as that I want.
What I find pretty strange is that my old app with the 'db.table1' syntax
run (no ticket) under 1.91.6.
Any explanations will be really appreciate... Is there a change in the way
web2py works? Could it be a web2py conf that I had put in my old app that is
responsable...
Thanks
Richard