本文整理汇总了Python中gluon.html.LI属性的典型用法代码示例。如果您正苦于以下问题:Python html.LI属性的具体用法?Python html.LI怎么用?Python html.LI使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类gluon.html
的用法示例。
在下文中一共展示了html.LI属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: widget
# 需要导入模块: from gluon import html [as 别名]
# 或者: from gluon.html import LI [as 别名]
def widget(cls, field, value, **attributes):
_id = '%s_%s' % (field.tablename, field.name)
_name = field.name
if field.type == 'list:integer':
_class = 'integer'
else:
_class = 'string'
requires = field.requires if isinstance(
field.requires, (IS_NOT_EMPTY, IS_LIST_OF)) else None
if isinstance(value, str):
value = [value]
nvalue = value or ['']
items = [LI(INPUT(_id=_id, _class=_class, _name=_name,
value=v, hideerror=k < len(nvalue) - 1,
requires=requires),
**attributes) for (k, v) in enumerate(nvalue)]
attributes['_id'] = _id + '_grow_input'
attributes['_style'] = 'list-style:none'
attributes['_class'] = 'w2p_list'
return UL(*items, **attributes)
示例2: widget
# 需要导入模块: from gluon import html [as 别名]
# 或者: from gluon.html import LI [as 别名]
def widget(cls, field, value, **attributes):
_id = '%s_%s' % (field.tablename, field.name)
_name = field.name
if field.type == 'list:integer':
_class = 'integer'
else:
_class = 'string'
requires = field.requires if isinstance(
field.requires, (IS_NOT_EMPTY, IS_LIST_OF)) else None
if isinstance(value, str): value = [value]
nvalue = value or ['']
items = [LI(INPUT(_id=_id, _class=_class, _name=_name,
value=v, hideerror=k < len(nvalue) - 1,
requires=requires),
**attributes) for (k, v) in enumerate(nvalue)]
attributes['_id'] = _id + '_grow_input'
attributes['_style'] = 'list-style:none'
attributes['_class'] = 'w2p_list'
return TAG[''](UL(*items, **attributes))
示例3: formstyle_ul
# 需要导入模块: from gluon import html [as 别名]
# 或者: from gluon.html import LI [as 别名]
def formstyle_ul(form, fields):
""" unordered list """
table = UL()
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(LI(_label, _controls, _help, _id=id))
return table
示例4: test_LI
# 需要导入模块: from gluon import html [as 别名]
# 或者: from gluon.html import LI [as 别名]
def test_LI(self):
self.assertEqual(LI('<>', _a='1', _b='2').xml(),
b'<li a="1" b="2"><></li>')