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