1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-27 13:34:28 +00:00
This commit is contained in:
Steffo 2019-01-15 00:21:41 +01:00
parent 686e9975bc
commit d4409c9774

View file

@ -192,7 +192,7 @@ def page_password():
@app.route("/editprofile", methods=["GET", "POST"]) @app.route("/editprofile", methods=["GET", "POST"])
@require_login @require_login
def page_editprofile(): def page_editprofile():
profile_data = fl_g.session.query(db.ProfileData).filter_by(royal_id=fl_g.user_id).join(db.Royal).one_or_none() profile_data = fl_g.session.query(db.ProfileData).filter_by(royal_id=fl_g.user.id).join(db.Royal).one_or_none()
if request.method == "GET": if request.method == "GET":
return render_template("profileedit.html", data=profile_data) return render_template("profileedit.html", data=profile_data)
elif request.method == "POST": elif request.method == "POST":
@ -202,7 +202,7 @@ def page_editprofile():
abort(400) abort(400)
return return
if profile_data is None: if profile_data is None:
profile_data = db.ProfileData(royal_id=fl_g.user_id, css=css, bio=bio) profile_data = db.ProfileData(royal_id=fl_g.user.id, css=css, bio=bio)
fl_g.session.add(profile_data) fl_g.session.add(profile_data)
fl_g.session.flush() fl_g.session.flush()
profile_data.royal.fiorygi += 1 profile_data.royal.fiorygi += 1
@ -218,7 +218,7 @@ def page_editprofile():
profile_data.css = css profile_data.css = css
profile_data.bio = bio profile_data.bio = bio
fl_g.session.commit() fl_g.session.commit()
royal = fl_g.session.query(db.Royal).filter_by(id=fl_g.user_id).one() royal = fl_g.session.query(db.Royal).filter_by(id=fl_g.user.id).one()
return redirect(url_for("page_profile", name=royal.username)) return redirect(url_for("page_profile", name=royal.username))