title: 'NoneType' object has no attribute 'username'?
body: <p>so i got this error</p>
  
  <p>AttributeError: 'NoneType' object has no attribute 'username'</p>
  
  <p>any suggestions, </p>
  
  <p><strong>Models.py</strong></p>
  
  <pre><code>class User(db.Model):
      __tablename__ = "users"
      id = db.Column(db.Integer, primary_key=True)
      username = db.Column(db.String(80), unique=True)
      password = db.Column(db.String(20), unique=True)
  
  
      def __init__(self, username, password):
          self.username = username
          self.password= bcrypt.generate_password_hash(password, 10)
  
  
  
  
      def is_authenticated(self):
          return True
  
  
      def is_active(self):
          return True
  
      def is_anonymous(self):
          return False
  
      def get_id(self):
          return (self.id)
  
  
      def __repr__(self):
          return '&lt;User %r&gt;' % self.username
  </code></pre>
  
  <p><strong>Views.py</strong></p>
  
  <pre><code>@app.route('/register', methods=['GET','POST'])
  def register():
      if request.method == 'GET':
          return render_template('register.html')
      user = User(request.form['username'] , request.form['password'] )
      username = request.form['username']
      password = request.form['password']
      storeduser = User.query.filter_by(username=username).first()
      if storeduser.username is not None and storeduser.username == request.form['username']:
          return 'User already Exist !'
      else:
          db.session.add(user)
          db.session.commit()
          flash('User successfully registered')
          return redirect(url_for('index'))
  </code></pre>
  
  <p>Pretty much if client username matches a current username output
  Existing user registered, if not register username.</p>
  
  <p>im referring to my username in my models(in case you were wondering)</p>