fix #5
This commit is contained in:
@@ -150,11 +150,32 @@ def edit(mid):
|
||||
|
||||
edit_location = "stamps"
|
||||
|
||||
if "new_section" in request.form:
|
||||
section_title = request.form["section_title"]
|
||||
section_content = request.form["section_content"]
|
||||
|
||||
db.execute("INSERT INTO sections (member_id, title, content) VALUES (?, ?, ?)", (mid, section_title, section_content))
|
||||
db.commit()
|
||||
|
||||
edit_location = "sections"
|
||||
|
||||
if "update_section" in request.form:
|
||||
section_id = request.form["section_id"]
|
||||
section_title = request.form["section_title"]
|
||||
section_content = request.form["section_content"]
|
||||
section_position = request.form["section_pos"]
|
||||
|
||||
db.execute("UPDATE sections SET title=(?), content=(?), position=(?) WHERE id=(?)",(section_title, section_content, section_position, section_id))
|
||||
db.commit()
|
||||
|
||||
edit_location = "sections"
|
||||
|
||||
|
||||
member = db.execute("SELECT * FROM member WHERE id=(?)",(mid,)).fetchone()
|
||||
icons = db.execute("SELECT * FROM icons WHERE member_id=(?)",(mid,)).fetchall()
|
||||
blinkies = db.execute("SELECT * FROM blinkies WHERE member_id=(?)",(mid,)).fetchall()
|
||||
stamps = db.execute("SELECT * FROM stamps WHERE member_id=(?)",(mid,)).fetchall()
|
||||
sections = db.execute("SELECT * FROM sections WHERE member_id=(?)",(mid,)).fetchall()
|
||||
|
||||
groups = db.execute("SELECT * FROM groups").fetchall()
|
||||
member_groups = db.execute("SELECT * FROM group_members WHERE member_id=(?)",(mid,)).fetchall()
|
||||
@@ -174,7 +195,18 @@ def edit(mid):
|
||||
|
||||
themes = os.listdir(current_app.config["THEMES_FOLDER"])
|
||||
|
||||
return render_template("manage/edit.html", member=member, icons=icons, unjoined_groups=unjoined_groups, joined_groups=joined_groups, themes=themes, edit_location=edit_location, blinkies=blinkies, stamps=stamps)
|
||||
return render_template("manage/edit.html", member=member, icons=icons, unjoined_groups=unjoined_groups, joined_groups=joined_groups, themes=themes, edit_location=edit_location, blinkies=blinkies, stamps=stamps, sections=sections)
|
||||
|
||||
|
||||
@bp.route("/delete_section/<sid>")
|
||||
@login_required
|
||||
def delete_section(sid):
|
||||
db = get_db()
|
||||
mid = db.execute("SELECT member_id FROM sections WHERE id=(?)",(sid,)).fetchone()[0]
|
||||
db.execute("DELETE FROM sections WHERE id=(?)",(sid,))
|
||||
db.commit()
|
||||
|
||||
return redirect(url_for("manage.edit", mid=mid))
|
||||
|
||||
@bp.route("/set_main_icon/<mid>/<icon_id>")
|
||||
@login_required
|
||||
|
||||
Reference in New Issue
Block a user