本文整理匯總了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))
)