Home | Trees | Indices | Help |
|
---|
|
object --+ | html.XmlComponent --+ | html.DIV --+ | html.FORM --+ | SQLFORM
SQLFORM is used to map a table (and a current record) into an HTML form given a SQLTable stored in db.table generates an insert form:: SQLFORM(db.table) generates an update form:: record=db.table[some_id] SQLFORM(db.table, record) generates an update with a delete button:: SQLFORM(db.table, record, deletable=True) if record is an int:: record=db.table[record] optional arguments: :param fields: a list of fields that should be placed in the form, default is all. :param labels: a dictionary with labels for each field, keys are the field names. :param col3: a dictionary with content for an optional third column (right of each field). keys are field names. :param linkto: the URL of a controller/function to access referencedby records see controller appadmin.py for examples :param upload: the URL of a controller/function to download an uploaded file see controller appadmin.py for examples any named optional attribute is passed to the <form> tag for example _class, _id, _style, _action, _method, etc.
|
|||
|
|||
|
|||
|
|||
|
|||
Inherited from Inherited from Inherited from Inherited from Inherited from |
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
widgets = <Storage {'multiple': <class 'gluon.sqlhtml.Multiple
|
|||
formstyles = <Storage {'table2cols': <function formstyle_table
|
|||
FIELDNAME_REQUEST_DELETE =
|
|||
FIELDKEY_DELETE_RECORD =
|
|||
ID_LABEL_SUFFIX =
|
|||
ID_ROW_SUFFIX =
|
|||
AUTOTYPES =
|
|||
Inherited from Inherited from |
|
|||
Inherited from |
|
|
SQLFORM(db.table, record=None, fields=['name'], labels={'name': 'Your name'}, linkto=URL(f='table/db/')
|
similar FORM.accepts but also does insert, update or delete in DAL. but if detect_record_change == True than: form.record_changed = False (record is properly validated/submitted) form.record_changed = True (record cannot be submitted because changed) elseif detect_record_change == False than: form.record_changed = None
|
generates a SQLFORM for the given fields. Internally will build a non-database based data model to hold the fields. |
@auth.requires_login() def index(): db.define_table('person',Field('name'),format='%(name)s') db.define_table('dog', Field('name'),Field('owner',db.person),format='%(name)s') db.define_table('comment',Field('body'),Field('dog',db.dog)) if db(db.person).isempty(): from gluon.contrib.populate import populate populate(db.person,300) populate(db.dog,300) populate(db.comment,1000) db.commit() form=SQLFORM.smartgrid(db[request.args(0) or 'person']) #*** return dict(form=form) *** builds a complete interface to navigate all tables links to the request.args(0) table: pagination, search, view, edit, delete, children, parent, etc. constraints is a dict {'table':query} that limits which records can be accessible links is a dict like {'tablename':[lambda row: A(....), ...]} that will add buttons when table tablename is displayed linked_tables is a optional list of tablenames of tables to be linked |
|
widgets
|
formstyles
|
AUTOTYPES
|
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Sun Mar 16 02:36:18 2014 | http://epydoc.sourceforge.net |