Beispiel #1
0
    def validate_username(self, field):
        user = User.query.filter(db.and_(
                                 User.username.like(field.data),
                                 db.not_(User.id == self.user.id))).first()

        if user:
            raise ValidationError(gettext(u"用户名已经存在"))
Beispiel #2
0
    def validate_title(self, field):
        case = Case.query.filter(db.and_(
                                 Case.title.like(field.data),
                                 db.not_(Case.id == self.case.id))).first()

        if case:
            raise ValidationError(gettext(u"用例名已经存在"))
Beispiel #3
0
 def validate_name(self, field):
     code = Code.query.filter(db.and_(
                              Code.name.like(field.data),
                              db.not_(Code.id == self.code.id))).first()
     if code:
         raise ValidationError(gettext(u"名称已经存在"))
         
Beispiel #4
0
 def validate_name(self, field):
     moduleType = ModuleType.query.filter(
         db.and_(ModuleType.name.like(field.data),
                 db.not_(ModuleType.id == self.moduleType.id))).first()
     if moduleType:
         raise ValidationError(gettext(u"模块名已经存在"))
Beispiel #5
0
 def validate_name(self, field):
     machine = Machine.query.filter(
         db.and_(Machine.name.like(field.data),
                 db.not_(Machine.id == self.machine.id))).first()
     if machine:
         raise ValidationError(gettext(u"机器名已经存在"))
Beispiel #6
0
 def validate_name(self, field):
     code = Code.query.filter(
         db.and_(Code.name.like(field.data),
                 db.not_(Code.id == self.code.id))).first()
     if code:
         raise ValidationError(gettext(u"名称已经存在"))
Beispiel #7
0
 def validate_name(self, field):
     task = Task.query.filter(db.and_(Task.name.like(field.data),
                                      db.not_(Task.id == self.task.id))).first()
     if task:
         raise ValidationError(gettext(u"名称已经被使用"))
Beispiel #8
0
 def validate_email(self, field):
     user = User.query.filter(db.and_(
                              User.email.like(field.data),
                              db.not_(User.id == self.user.id))).first()
     if user:
         raise ValidationError(gettext(u"邮箱地址已经存在"))
Beispiel #9
0
 def validate_name(self, field):
     task = Task.query.filter(
         db.and_(Task.name.like(field.data),
                 db.not_(Task.id == self.task.id))).first()
     if task:
         raise ValidationError(gettext(u"名称已经被使用"))