title: Why is check_password_hash always returning False in this login view?
body: <p>I have a user model with functions to set and check a password using Werkzeug's <code>set_password_hash</code> and <code>check_password_hash</code> functions.</p>
  
  <p>models.py</p>
  
  <pre><code>class User(db.Model):
      id = db.Column(db.Integer, primary_key = True)
      username = db.Column(db.String(15), unique = True)
      password = db.Column(db.String(15))
      tasks = db.relationship('Task', backref='author', lazy='dynamic')
  
      def __init__(self, username, password):
          self.username = username
          self.set_password(password)
  
      def set_password(self, password):
          self.password = generate_password_hash(password)
  
      def check_password(self, password):
          return check_password_hash(self.password, password)
  </code></pre>
  
  <p>login.py</p>
  
  <pre><code>def post(self): 
      username = flask.request.form['username']
      passwd = flask.request.form['passwd']
      user = User.query.filter_by(username = username).first()
      flask.flash(user.check_password(user.password))
      if user and user.check_password(user.password):
          flask.session['username'] = username
      else:
          flask.flash("User doesn't exist or password is inccorect.")
          return flask.render_template('login.html')
      return flask.render_template('index.html')
  </code></pre>
  
  <p>The flashed result of <code>check_password</code> is always "False".  What am I doing wrong?</p>