Hello, sorry to bother you guys but I can figure it out how I can solve
this problem.
I have the following tables:
########################################
db.define_table('t_unit',
Field('f_unit', type='string', label=T('Unit')),
auth.signature,
format='%(f_unit)s',
singular="Unit",
migrate=settings.migrate)
########################################
db.define_table('t_offices',
Field('f_office', type='string', label=T('Office number')),
auth.signature,
singular="Office",
format='%(f_office)s',
migrate=settings.migrate)
########################################
db.define_table('t_unit_offices',
Field('f_unit', 'reference t_unit', label=T('Unit')),
Field('f_office', 'reference t_offices', label=T('Office')),
auth.signature,
singular="Office",
format= '%(f_office)s',
migrate=settings.migrate)
Is a many to many relationship.
One unit can have many offices and one office can be shared by more than
one unit.
I'm displaying it with a smartgrid:
assets = SQLFORM.smartgrid(db.t_unit, linked_tables=['t_unit_offices'],
csv = False,
deletable = True,
editable = True,
create = True,
paginate=100
)
That works well.
But now I need to have the following relationship: one specific office in
one unit have many computers (1:n)
I created the following table:
########################################
db.define_table('t_computers',
Field('f_office', 'reference t_unit_offices', label=T('Office')),
Field('f_inv_nr', type='string',
label=T('Inventory number')),
Field('f_stag', type='string', label=T('ST')),
auth.signature,
format='%(f_inv_nr)s',
singular="Computer",
plural="Computers",
migrate=settings.migrate)
and modified the smartgrid definition like that:
assets = SQLFORM.smartgrid(db.t_unit, linked_tables=['t_unit_offices',
't_computers'],
csv = False,
deletable = True,
editable = True,
create = True,
paginate=100
)
It works well but when I click in the "Hardwares" link it shows the
following in the breadcrumbs:
Units>A1>Offices>*8*>Hardware
How can I manage to get the name of the office instead of the id?
Thank you very much for all.
Kind regards.
--
---
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.