The field leave_type in the leave_requests table is joined to the leave_allocations table. The drop down in the leave_requests SQLFORM shows only the primary ids in the dropdown. This is not what I need. I need the format strings to be human readable.
Here is now the tables are joined. ############### # leave_types # ###############---<>##################### ################## # leave_allocations #<>---# leave_requests # ###############---<>##################### ################## # auth_user # ############### Here is the requires code for the field db.leave_requests.leave_type.requires = IS_IN_DB(db, 'leave_allocations.id', '%(leave_type)s %(employee_id)s') The SQLFORM drop down displays the numeric ids for leave_types and auth_user, but I want to display format sting from the leave_types table and the registration_id from the auth_user table. How do I set the format strings for tables not directly joined? Below are the tables from my model. db.define_table( 'leave_types', Field('leave_type'), Field('unlimited','boolean'), Field('is_active','boolean'), format = '%(leave_type)s' ) db.leave_types.leave_type.requires = IS_NOT_EMPTY() db.define_table( 'leave_allocations', Field('leave_type'), Field('duration','integer'), Field('employee_id' ) format = '%(leave_type)s %(employee_id)s' ) db.leave_allocations.leave_type.requires = IS_IN_DB(db, db.leave_types.id, '%(leave_type)s') db.leave_allocations.employee_id.requires = IS_IN_DB(db, 'auth_user.id', '%(registration_id)s') db.define_table( 'leave_requests', Field('employee'), Field('description'), Field('leave_type'), Field('start_date','date'), Field('end_date','date'), Field('duration','integer'), Field('status'), Field('manager_comment') ) db.leave_requests.leave_type.requires = IS_IN_DB(db, 'leave_allocations.id', '%(leave_type)s %(employee_id)s') db.leave_requests.employee.requires = IS_IN_DB(db, 'auth_user.id', '%(registration_id)s') db.leave_requests.duration.requires = [IS_NOT_EMPTY(), IS_INT_IN_RANGE(0, 30)] db.leave_requests.start_date.requires = [IS_DATE(), IS_NOT_EMPTY()] db.leave_requests.end_date.requires = [IS_DATE(), IS_NOT_EMPTY()] db.leave_requests.description.requires = IS_NOT_EMPTY() -- 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.