AttributeError: 'NoneType' object has no attribute 'email'. Flask-sqlalchemy

Viewed 371

i've a strange problem...

i do this:

  if request.method=="POST":

        email = request.form["email"]
        session["email"] = email

        found_user = users.query.filter_by(username=username).first()
        found_user.email = email
        db.session.commit()

and gives me this problem:

        found_user.email = email
        AttributeError: 'NoneType' object has no attribute 'email'

Who can help me?? thanks <3

1 Answers

it means it didn't find any users matching your filter

Related