Hi, I'm the original poster, but just changed my email...
I did get this to work so will post the solution for others:
Here's the table:
db.define_table('department',
Field('Department_Name', requires = IS_NOT_EMPTY()),
Field('contact_email', length=128, requires = [IS_EMAIL(),
IS_NOT_EMPTY()]),
format = '%(Department_Name)s'
)
Here's two of the fields in another table which references
'department':
....
Field('From_Department', db.department, writable=False),
Field('To_Department', db.department),
....
and both fields display the Department_Name and not the id.
So:
1 - Set the format in the referenced table like so.... format = '%
(Department_Name)s'
2 - In the field, remember to specify the table as the field type....
db.department
3 - Don't include a "requires IS_IN_DB" argument in the field
definition, this is a red herring*
4 - It makes no difference whether the field is set to writeable =
False (in my case I needed both)
* The web2py book seems to indicate this is the way to do things, but
it seems that applying points 1 & 2 above is a preferable alternative
(for some situations in any case).
Thanks for the help & replies.