Fix integer issues for custom css not creating

This commit is contained in:
Jeremy Zhang 2018-01-24 06:03:31 +00:00
parent e5f7a90773
commit 45f33971ed
2 changed files with 3 additions and 1 deletions

View File

@ -373,4 +373,5 @@ def new_custom_css_post():
css = None css = None
css = UserCSS(name, user_id, variables_enabled, variables, css) css = UserCSS(name, user_id, variables_enabled, variables, css)
db.session.add(css) db.session.add(css)
db.session.commit()
return jsonify({"id": css.id}) return jsonify({"id": css.id})

View File

@ -119,6 +119,7 @@ def new_custom_css_post():
css = None css = None
css = UserCSS(name, user_id, variables_enabled, variables, css) css = UserCSS(name, user_id, variables_enabled, variables, css)
db.session.add(css) db.session.add(css)
db.session.commit()
return jsonify({"id": css.id}) return jsonify({"id": css.id})
@user.route("/custom_css/edit/<css_id>", methods=["GET"]) @user.route("/custom_css/edit/<css_id>", methods=["GET"])
@ -130,7 +131,7 @@ def edit_custom_css_get(css_id):
css = db.session.query(UserCSS).filter(UserCSS.id == css_id).first() css = db.session.query(UserCSS).filter(UserCSS.id == css_id).first()
if not css: if not css:
abort(404) abort(404)
if css.user_id != session['user_id']: if str(css.user_id) != str(session['user_id']):
abort(403) abort(403)
variables = css.css_variables variables = css.css_variables
if variables: if variables: