我们从Python开源项目中,提取了以下21个代码示例,用于说明如何使用wtforms.widgets.HiddenInput()。
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)) )
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