Beispiel #1
0
 def validate_link(self, field):
     posts = Post.query.public().filter_by(link=field.data)
     if self.post:
         posts = posts.filter(db.not_(Post.id == self.post.id))
     if posts.count():
         raise ValidationError(
             message=gettext("This link has already been posted"))
Beispiel #2
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(message=gettext("This username is taken"))
Beispiel #3
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(message=gettext("This username is taken"))
Beispiel #4
0
 def validate_link(self, field):
     posts = Post.query.public().filter_by(link=field.data)
     if self.post:
         posts = posts.filter(db.not_(Post.id == self.post.id))
     if posts.count():
         raise ValidationError(
             message=gettext("This link has already been posted"))
Beispiel #5
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("This email is taken")