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.')
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
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.')