Bear with me my language is not english, so ill try to be plain and
straight

i have a table that references another 2 tables.
when im generating the form works nicely as i want, but when i
retrieve the list with a db select all i dont get the referenced names
of the tables...i get only the id's...how should i do it to get the
names ('nome')? thanks.
im thinking about a join, but cant seem to do it....

db.define_table('edificios',
   Field('nome'),
   Field('morada'))

db.define_table('tipoavaria',
   Field('nome'))

db.define_table('avariasdb',
   Field('user', db.auth_user, default=auth.user_id,
writable=False,readable=False),
   Field('edificio', db.edificios),
   Field('piso'),
   Field('tipo', db.tipoavaria),
   Field('descricao', 'string', widget=SQLFORM.widgets.text.widget),
   Field('data', 'datetime', default=request.now, writable=False))

db.avariasdb.edificio.requires = IS_IN_DB(db, 'edificios.id',
'edificios.nome', zero=T('Choose One'))
db.avariasdb.tipo.requires = IS_IN_DB(db, 'tipoavaria.id',
'tipoavaria.nome', zero=T('Choose One'))

Reply via email to