本文整理汇总了Python中members.models.Member.find_by_id方法的典型用法代码示例。如果您正苦于以下问题:Python Member.find_by_id方法的具体用法?Python Member.find_by_id怎么用?Python Member.find_by_id使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类members.models.Member
的用法示例。
在下文中一共展示了Member.find_by_id方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: validate_client_id
# 需要导入模块: from members.models import Member [as 别名]
# 或者: from members.models.Member import find_by_id [as 别名]
def validate_client_id(form, field):
if not field.data:
return
member = Member.find_by_id(field.data)
if not member:
raise ValidationError('Client not found.')
示例2: validate_member_id
# 需要导入模块: from members.models import Member [as 别名]
# 或者: from members.models.Member import find_by_id [as 别名]
def validate_member_id(form, field):
from members.models import Member
if request.method == 'POST':
if not form.member_id.data:
raise ValidationError(field.gettext('This field is required.'))
field.member = Member.find_by_id(field.data)
if not member:
raise ValidationError('Member not found.')
else:
field.data = None
示例3: validate_owner_id
# 需要导入模块: from members.models import Member [as 别名]
# 或者: from members.models.Member import find_by_id [as 别名]
def validate_owner_id(form, field):
if field.data:
member = Member.find_by_id(field.data)
if not member:
raise ValidationError('Member (owner) was not found.')