I have a table defined as follows:
db.define_table('org',
Field('name'),
Field('otype',db.orgtypes, label='Type'),
Field('jurisdiction',db.jurisdictions),
Field('created_by',db.auth_user,readable=True,writable=False),
Field('created','datetime',default=request.now,readable=False,writable=False),
Field('last_activity','datetime',default=request.now,readable=False,writable=False),
Field('deletedflag', comment='This flags the record as deleted,
but does not remove.', writable=False, readable=False),
migrate=migrate_db)
db.org.name.requires = [IS_NOT_EMPTY(),IS_NOT_IN_DB(db, 'org.name')]
db.org.otype.requires = IS_IN_DB(db, 'orgtypes.id', '%(name)s',
zero=T('choose one'))
db.org.jurisdiction.requires = IS_IN_DB(db, 'jurisdictions.id',
'%(name)s', zero=T('choose one'))
if auth.is_logged_in():
db.org.created_by.default = auth.user.id
and am trying to use SQLForm.grid like this - SQLFORM.smartgrid(db.org)
The display shows the name of the create_by field by automatically looking
up the id of the user who created the organization record, however neither
the jurisdictio field, nor the otype field do the same. Both display the
primary key instead of the appropriate names.
A second issue that may be related in the actual display of the of the
auto-rederenced user is David Waldrop (29) - where 29 is the primary key of
the user. I would like to eliminate this as well as it means nothing to
the user.
I have played with represents, but cannot figure out why the behavior seesm
inconsistent. Any suggestions are very much appreciated?
--