本文整理汇总了Python中gluon.html.FIELDSET属性的典型用法代码示例。如果您正苦于以下问题:Python html.FIELDSET属性的具体用法?Python html.FIELDSET怎么用?Python html.FIELDSET使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类gluon.html
的用法示例。
在下文中一共展示了html.FIELDSET属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: formstyle_divs
# 需要导入模块: from gluon import html [as 别名]
# 或者: from gluon.html import FIELDSET [as 别名]
def formstyle_divs(form, fields):
""" divs only """
table = FIELDSET()
for id, label, controls, help in fields:
_help = DIV(help, _class='w2p_fc')
_controls = DIV(controls, _class='w2p_fw')
_label = DIV(label, _class='w2p_fl')
table.append(DIV(_label, _controls, _help, _id=id))
return table
示例2: test_FIELDSET
# 需要导入模块: from gluon import html [as 别名]
# 或者: from gluon.html import FIELDSET [as 别名]
def test_FIELDSET(self):
self.assertEqual(FIELDSET('<>', _a='1', _b='2').xml(),
b'<fieldset a="1" b="2"><></fieldset>')
示例3: formstyle_bootstrap
# 需要导入模块: from gluon import html [as 别名]
# 或者: from gluon.html import FIELDSET [as 别名]
def formstyle_bootstrap(form, fields):
""" bootstrap 2.3.x format form layout """
form.add_class('form-horizontal')
parent = FIELDSET()
for id, label, controls, help in fields:
# wrappers
_help = SPAN(help, _class='help-block')
# embed _help into _controls
_controls = DIV(controls, _help, _class='controls')
# submit unflag by default
_submit = False
if isinstance(controls, INPUT):
controls.add_class('span4')
if controls['_type'] == 'submit':
# flag submit button
_submit = True
controls['_class'] = 'btn btn-primary'
if controls['_type'] == 'file':
controls['_class'] = 'input-file'
# For password fields, which are wrapped in a CAT object.
if isinstance(controls, CAT) and isinstance(controls[0], INPUT):
controls[0].add_class('span4')
if isinstance(controls, SELECT):
controls.add_class('span4')
if isinstance(controls, TEXTAREA):
controls.add_class('span4')
if isinstance(label, LABEL):
label['_class'] = add_class(label.get('_class'), 'control-label')
if _submit:
# submit button has unwrapped label and controls, different class
parent.append(DIV(label, controls, _class='form-actions', _id=id))
# unflag submit (possible side effect)
_submit = False
else:
# unwrapped label
parent.append(DIV(label, _controls, _class='control-group', _id=id))
return parent
示例4: formstyle_bootstrap
# 需要导入模块: from gluon import html [as 别名]
# 或者: from gluon.html import FIELDSET [as 别名]
def formstyle_bootstrap(form, fields):
""" bootstrap 2.3.x format form layout """
form.add_class('form-horizontal')
parent = FIELDSET()
for id, label, controls, help in fields:
# wrappers
_help = SPAN(help, _class='help-block')
# embed _help into _controls
_controls = DIV(controls, _help, _class='controls')
# submit unflag by default
_submit = False
if isinstance(controls, INPUT):
controls.add_class('span4')
if controls['_type'] == 'submit':
# flag submit button
_submit = True
controls['_class'] = 'btn btn-primary'
if controls['_type'] == 'file':
controls['_class'] = 'input-file'
# For password fields, which are wrapped in a CAT object.
if isinstance(controls, CAT) and isinstance(controls[0], INPUT):
controls[0].add_class('span4')
if isinstance(controls, SELECT):
controls.add_class('span4')
if isinstance(controls, TEXTAREA):
controls.add_class('span4')
if isinstance(label, LABEL):
label['_class'] = add_class(label.get('_class'),'control-label')
if _submit:
# submit button has unwrapped label and controls, different class
parent.append(DIV(label, controls, _class='form-actions', _id=id))
# unflag submit (possible side effect)
_submit = False
else:
# unwrapped label
parent.append(DIV(label, _controls, _class='control-group', _id=id))
return parent
示例5: formstyle_bootstrap
# 需要导入模块: from gluon import html [as 别名]
# 或者: from gluon.html import FIELDSET [as 别名]
def formstyle_bootstrap(form, fields):
""" bootstrap 2.3.x format form layout """
form.add_class('form-horizontal')
parent = FIELDSET()
for id, label, controls, help in fields:
# wrappers
_help = SPAN(help, _class='help-block')
# embed _help into _controls
_controls = DIV(controls, _help, _class='controls')
# submit unflag by default
_submit = False
if isinstance(controls, INPUT):
controls.add_class('span4')
if controls['_type'] == 'submit':
# flag submit button
_submit = True
controls['_class'] = 'btn btn-primary'
if controls['_type'] == 'file':
controls['_class'] = 'input-file'
# For password fields, which are wrapped in a CAT object.
if isinstance(controls, CAT) and isinstance(controls[0], INPUT):
controls[0].add_class('span4')
if isinstance(controls, SELECT):
controls.add_class('span4')
if isinstance(controls, TEXTAREA):
controls.add_class('span4')
if isinstance(label, LABEL):
label['_class'] = 'control-label'
if _submit:
# submit button has unwrapped label and controls, different class
parent.append(DIV(label, controls, _class='form-actions', _id=id))
# unflag submit (possible side effect)
_submit = False
else:
# unwrapped label
parent.append(DIV(label, _controls, _class='control-group', _id=id))
return parent