本文整理汇总了Python中wtforms.fields.HiddenField方法的典型用法代码示例。如果您正苦于以下问题:Python fields.HiddenField方法的具体用法?Python fields.HiddenField怎么用?Python fields.HiddenField使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wtforms.fields
的用法示例。
在下文中一共展示了fields.HiddenField方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: is_hidden_field_filter
# 需要导入模块: from wtforms import fields [as 别名]
# 或者: from wtforms.fields import HiddenField [as 别名]
def is_hidden_field_filter(field):
return isinstance(field, HiddenField)
示例2: _is_hidden
# 需要导入模块: from wtforms import fields [as 别名]
# 或者: from wtforms.fields import HiddenField [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
示例3: get_form
# 需要导入模块: from wtforms import fields [as 别名]
# 或者: from wtforms.fields import HiddenField [as 别名]
def get_form(klass):
"""Gets the appropriate form for a given investigation"""
form = model_form(klass, exclude=klass.exclude_fields)
# An empty name is the same as no name
form.name = WTFStringField(
'Name', filters=[lambda name: name or None])
form.created_by = WTFHiddenField(
'created_by', default=current_user.username)
form.tags = TagListField("Tags")
return form
示例4: register_template_utils
# 需要导入模块: from wtforms import fields [as 别名]
# 或者: from wtforms.fields import HiddenField [as 别名]
def register_template_utils(app):
"""Register Jinja 2 helpers (called from __init__.py)."""
@app.template_test()
def equalto(value, other):
return value == other
@app.template_global()
def is_hidden_field(field):
from wtforms.fields import HiddenField
return isinstance(field, HiddenField)
app.add_template_global(index_for_role)
示例5: create_app
# 需要导入模块: from wtforms import fields [as 别名]
# 或者: from wtforms.fields import HiddenField [as 别名]
def create_app(extra_config_settings={}):
"""Create a Flask application.
"""
# Instantiate Flask
app = Flask(__name__)
# Load common settings
app.config.from_object('app.settings')
# Load environment specific settings
app.config.from_object('app.local_settings')
# Load extra settings from extra_config_settings param
app.config.update(extra_config_settings)
# Setup Flask-SQLAlchemy
db.init_app(app)
# Setup Flask-Migrate
migrate.init_app(app, db)
# Setup Flask-Mail
mail.init_app(app)
# Setup WTForms CSRFProtect
csrf_protect.init_app(app)
# Register blueprints
from .views import register_blueprints
register_blueprints(app)
# Define bootstrap_is_hidden_field for flask-bootstrap's bootstrap_wtf.html
from wtforms.fields import HiddenField
def is_hidden_field_filter(field):
return isinstance(field, HiddenField)
app.jinja_env.globals['bootstrap_is_hidden_field'] = is_hidden_field_filter
# Setup an error-logger to send emails to app.config.ADMINS
init_email_error_handler(app)
# Setup Flask-User to handle user account related forms
from .models.user_models import User
from .views.main_views import user_profile_page
# Setup Flask-User
user_manager = UserManager(app, db, User)
@app.context_processor
def context_processor():
return dict(user_manager=user_manager)
return app