How to update SQLAlchemy row entry?

后端 未结 5 1063
-上瘾入骨i
-上瘾入骨i 2020-11-28 17:40

Assume table has three columns: username, password and no_of_logins.

When user tries to login, it\'s checked for an entry with

5条回答
  •  误落风尘
    2020-11-28 18:47

    With the help of user=User.query.filter_by(username=form.username.data).first() statement you will get the specified user in user variable.

    Now you can change the value of the new object variable like user.no_of_logins += 1 and save the changes with the session's commit method.

提交回复
热议问题