From 60df9c47bf62ecda40674e4774402ecf458d1f82 Mon Sep 17 00:00:00 2001 From: Tdxdxoz Date: Wed, 18 Nov 2020 20:59:48 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.py | 14 ++++++++++++++ templates/list.html | 8 ++++++++ 2 files changed, 22 insertions(+) diff --git a/app.py b/app.py index 1edd5b8..7aa9b27 100644 --- a/app.py +++ b/app.py @@ -133,6 +133,20 @@ def like(id): return str(c.likeNum) +@app.route('/ordinary//delete', methods=['POST']) +def delete(id): + key = request.form.get('key') + if key != C.key: + abort(401) + + c = Candidate.query.get(id) + if not c: + abort(404) + + db.session.delete(c) + db.session.commit() + + return redirect('..') if __name__ == '__main__': app.run(debug=True) diff --git a/templates/list.html b/templates/list.html index 4657ba0..8c8b51a 100644 --- a/templates/list.html +++ b/templates/list.html @@ -240,6 +240,14 @@ {% for c in pagination.items %}
+ {% if showPrivate %} +
+ + +
+ {% endif %} No. {{c.id}}
{{c.content}}
{% if showPrivate %}