server.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:Spent 作者: emilydowgialo 项目源码 文件源码
def profile_edit():
    """ Edit profile information """

    # Set the value of the user id of the user in the session
    id = session.get('id')

    # Query the database for the user
    user_info = User.query.filter_by(id=id).first()

    # Get information from the forms
    name = request.form.get("profile-name")
    email = request.form.get("profile-email")
    password = request.form.get("new-password")

    # Replace info in the database with new info
    if name:
        user_info.name = name
        db.session.commit()

    if password:
        user_info.password = password
        db.session.commit()

    if email:
        user_info.email = email
        db.session.commit()

    name_info = {
        'name': name,
        'email': email
    }

    # Return jsonified budget info to submit-new-account-info.js
    return jsonify(name_info)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号