本文整理汇总了Python中wtforms.validators.length方法的典型用法代码示例。如果您正苦于以下问题:Python validators.length方法的具体用法?Python validators.length怎么用?Python validators.length使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wtforms.validators
的用法示例。
在下文中一共展示了validators.length方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_TextField
# 需要导入模块: from wtforms import validators [as 别名]
# 或者: from wtforms.validators import length [as 别名]
def get_TextField(kwargs):
"""
Returns a ``TextField``, applying the ``ndb.StringProperty`` length limit
of 500 bytes.
"""
kwargs['validators'].append(validators.length(max=500))
return f.TextField(**kwargs)
示例2: convert_StringProperty
# 需要导入模块: from wtforms import validators [as 别名]
# 或者: from wtforms.validators import length [as 别名]
def convert_StringProperty(self, model, prop, kwargs):
"""Returns a form field for a ``ndb.StringProperty``."""
if prop._repeated:
return StringListPropertyField(**kwargs)
kwargs['validators'].append(validators.length(max=500))
return get_TextField(kwargs)
示例3: convert_GenericProperty
# 需要导入模块: from wtforms import validators [as 别名]
# 或者: from wtforms.validators import length [as 别名]
def convert_GenericProperty(self, model, prop, kwargs):
"""Returns a form field for a ``ndb.ListProperty``."""
kwargs['validators'].append(validators.length(max=500))
return get_TextField(kwargs)
示例4: get_TextField
# 需要导入模块: from wtforms import validators [as 别名]
# 或者: from wtforms.validators import length [as 别名]
def get_TextField(kwargs):
"""
Returns a ``TextField``, applying the ``db.StringProperty`` length limit
of 500 bytes.
"""
kwargs['validators'].append(validators.length(max=500))
return f.TextField(**kwargs)
示例5: convert_StringProperty
# 需要导入模块: from wtforms import validators [as 别名]
# 或者: from wtforms.validators import length [as 别名]
def convert_StringProperty(model, prop, kwargs):
"""Returns a form field for a ``db.StringProperty``."""
if prop.multiline:
kwargs['validators'].append(validators.length(max=500))
return f.TextAreaField(**kwargs)
else:
return get_TextField(kwargs)