def itemlist(): """ This plugin creates a large widget to display, edit, and add entries to one database table. LIST FORMAT By default the table rows are listed using either the "format" property of the table definition in the db model (if their is one), or the contents of the first table field (after the auto-generated id). ARGUMENTS Takes one required argument, the name of the table to be listed. A second optional argument provides the name of a field by which to order the list. VARIABLES An optional variable "restrictor" can be used to filter the displayed records. This variable must be a dictionary in which the keys are the names of fields in the table and the values are the values to be allowed in those fields when generating the list. """ lae = ListAndEdit() listset, flash, tname, orderby, restrictor = lae.itemlist(rargs=request.args, rvars=request.vars) if flash: response.flash = flash return {'listset': listset}
def widget(): """ This plugin creates a large widget to display, edit, and add entries to one database table. LIST FORMAT By default the table rows are listed using either the "format" property of the table definition in the db model (if their is one), or the contents of the first table field (after the auto-generated id). ARGUMENTS Takes one required argument, the name of the table to be listed. A second optional argument provides the name of a field by which to order the list. VARIABLES An optional variable "restrictor" can be used to filter the displayed records. This variable must be a dictionary in which the keys are the names of fields in the table and the values are the values to be allowed in those fields when generating the list. """ lae = ListAndEdit() itemlist, flash, tname, orderby, restrictor = \ lae.itemlist(rargs=request.args, rvars=request.vars) adder = A(SPAN(_class='glyphicon glyphicon-plus'), _href=URL('plugin_listandedit', 'edit.load', args=[tname], vars=request.vars), _class='plugin_listandedit_addnew badge badge-success', cid='viewpane') return {'listset': itemlist, 'tablename': tname, 'restrictor': restrictor, 'orderby': orderby, 'adder': adder}