I have some linked tables like so:
db.define_table('cities',
Field('city', 'string'),
format="%(city)s"
)
db.define_table('customers',
Field('customer', 'string'),
Field('contact_name', 'string'),
format="%(customer)s"
)
db.define_table('customers_job',
Field('city', db.cities),
Field('description', 'text'),
Field('customer', db.customer),
format="%(customer)s - %(city)s"
)
db.define_table('emp_hours',
Field('employee', db.employee),
Field('job', db.customers_jobs),
Field('work_date', 'date', default=request.now.date(), ),
Field('number_of_hours', 'integer', default=10),
)
My question is, when designing a CRUD/SQLFORM/whatever for the emp_hours
table, I would like the *db.emp_hours.job *field widget to display the
following in a drop-down:
- db.customers.customer
- db.cities.city,
- and the first 20 chars of db.customers_jobs.description
- (e.g. format="%(customer)s - %(city)s (%(description[:20])s)")
Is there any way that I can do this? I have tried constructing widgets &
validators, etc. But because the emp_hours.job is linking to the
customers_jobs and not the customers, it only displays the customers_jobs.id
.
Thanks in advance!