Esempio n. 1
0
 def validate_new_name(form, field):
     """Validate that the new account name isn't taken"""
     if Account.count(Q.name == field.data) > 0:
         raise ValidationError('Account name already taken.')
Esempio n. 2
0
 def validate_name(form, field):
     """Validate that the account name exists"""
     if Account.count(Q.name == field.data) == 0:
         raise ValidationError('Account not found.')