Represent functions are used to control the display of a field's value
for output in forms:
db.thing.id.represent = lambda value:
A(value,_href=URL('show',args=value))Widget functions are used to control the input of a field's value in forms: db.thing.name.widget = lambda field,value: SQLFORM.widgets.string.widget(field,value) Format is a convenience that sets a represent function on a table so that referencing fields display useful information instead of the record id in forms. It also sets a validator (IS_IN_DB), which in turn sets a widget (SQLFORM.widgets.options.widget) so that forms use a dropdown of the referenced field's available values. On Dec 9, 6:46 pm, John-Kim Murphy <[email protected]> wrote: > In the Web2Py book section describing the format attribute of a table > there is a brief mention of represent. It seems they serve related but > different purposes. Also the label parameter of IS_IN_DB() is also very > similar. > They all have the same format, anyways (and accept lambda functions) > > What are the different situations where these should be used? > > I have not been able to produce any noticeable results from format, I'm > not sure now to use represent, and IS_IN_DB(.., label) formats menu > items in the drop down when inserting via appadmin. > (I was originally trying to format the references in the appadmin query > interface) > > John

