本文整理汇总了Python中wtforms.widgets.HiddenInput方法的典型用法代码示例。如果您正苦于以下问题:Python widgets.HiddenInput方法的具体用法?Python widgets.HiddenInput怎么用?Python widgets.HiddenInput使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wtforms.widgets
的用法示例。
在下文中一共展示了widgets.HiddenInput方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _is_hidden
# 需要导入模块: from wtforms import widgets [as 别名]
# 或者: from wtforms.widgets import HiddenInput [as 别名]
def _is_hidden(field):
"""Detect if the field is hidden."""
if isinstance(field, HiddenField):
return True
if isinstance(field.widget, HiddenInput):
return True
return False
示例2: hidden_tag
# 需要导入模块: from wtforms import widgets [as 别名]
# 或者: from wtforms.widgets import HiddenInput [as 别名]
def hidden_tag(self, *fields):
"""Render the form's hidden fields in one call.
A field is considered hidden if it uses the
:class:`~wtforms.widgets.HiddenInput` widget.
If ``fields`` are given, only render the given fields that
are hidden. If a string is passed, render the field with that
name if it exists.
.. versionchanged:: 0.13
No longer wraps inputs in hidden div.
This is valid HTML 5.
.. versionchanged:: 0.13
Skip passed fields that aren't hidden.
Skip passed names that don't exist.
"""
def hidden_fields(fields):
for f in fields:
if isinstance(f, string_types):
f = getattr(self, f, None)
if f is None or not isinstance(f.widget, HiddenInput):
continue
yield f
return Markup(
u'\n'.join(text_type(f) for f in hidden_fields(fields or self))
)