示例#1
0
 def validate_alias(form, field):
     if form.alias.data == 'new':
         raise wtforms.ValidationError(flask.Markup(
             'The alias cannot be <code>new</code>.'))
     check = Election.search(SESSION, alias=form.alias.data)
     if check:
         if not (form._election_id and form._election_id == check[0].id):
             raise wtforms.ValidationError(
                 'There is already another election with this alias.')
示例#2
0
 def validate_alias(form, field):
     if form.alias.data == 'new':
         raise wtforms.ValidationError(flask.Markup(
             'The alias cannot be <code>new</code>.'))
     check = Election.search(SESSION, alias=form.alias.data)
     if check:
         if not (form._election_id and form._election_id == check[0].id):
             raise wtforms.ValidationError(
                 'There is already another election with this alias.')
示例#3
0
 def validate_shortdesc(form, field):
     check = Election.search(SESSION, shortdesc=form.shortdesc.data)
     if check:
         if not (form._election_id and form._election_id == check[0].id):
             raise wtforms.ValidationError(
                 'There is already another election with this summary.')
示例#4
0
 def validate_shortdesc(form, field):
     check = Election.search(SESSION, shortdesc=form.shortdesc.data)
     if check:
         if not (form._election_id and form._election_id == check[0].id):
             raise wtforms.ValidationError(
                 'There is already another election with this summary.')