Check this out. I added this to formmaker.py It creates a select box
if your SQLObject class has an attribute named 'option_name'.
option_name should be configurable. Really cool I think!
# Added to handle foreign keys.
def column_widget_fk_col(column):
parms = column_parms(column)
fk_class_name = column.foreignKey
fk_class = sqlobject.classregistry.findClass(fk_class_name)
fk_class_data = fk_class.select()
if hasattr(fk_class, 'option_name'):
options = [[rset.id, rset.option_name] for rset in
fk_class_data]
return widgets.SelectField(validator=None, options=options,
**parms)
else:
return widgets.TextField(validator=None, **parms)
column_widget_fk_col = column_widget.when(
"isinstance(column, col.SOKeyCol)")(column_widget_fk_col)