title: Error: Type object has no attribute 'Query'
body: <p>I am trying to create my first website using Python + flask and am now having issues trying to add data to SQLite database using Flask-SQLAlchemy.</p>
  
  <p>This is part where I am trying to add user to database but it fails:</p>
  
  <pre><code>@app.route('/register', methods=['GET','POST'])
  def register():
      if request.method == 'GET':
          return render_template('registracija.html')
      elif request.method == 'POST':
          username = request.form['username']
          password = request.form['password']
  
  
          user = User.Query(filter_by=username)
          if user.count() == 0:
              user = User(username=username, password=password)
              db.session.add(user)
              db.session.commit()
  
              flash('You have registered the username {0}. Please login'.format(username))
              return redirect(url_for('login'))
          else:
              flash('The username {0} is already in use.  Please try a new username.'.format(username))
              return redirect(url_for('register'))
      else:
          abort(405)
  </code></pre>
  
  <p>And my register.html page:</p>
  
  <pre><code>&lt;form method="post" &gt;
    &lt;div class="col-md-4"&gt;
      Username: &lt;br /&gt;
      Password: &lt;br /&gt;
      Please repeat password: &lt;br /&gt;
   &lt;/div&gt;
   &lt;div class="col-md-4"&gt;
     &lt;input type="text" name="username" /&gt; &lt;br /&gt;
     &lt;input type="password" name="password" /&gt;  &lt;br /&gt;
     &lt;input type="password" name="repeatpassword" /&gt; &lt;br /&gt; &lt;br /&gt;
     &lt;input type="submit" name="register" value="Registruotis" /&gt;
  &lt;/div&gt;
  
  &lt;/form&gt;
  </code></pre>
  
  <p>When I fill form and press register button I get:</p>
  
  <blockquote>
    <p><em>AttributeError: type object 'User' has no attribute 'Query'</em></p>
  </blockquote>
  
  <p>Would be nice if someone could point me what I am doing wrong. I am running Python 3.5 On Windows 10.</p>