|
|
@ -133,6 +133,20 @@ def like(id): |
|
|
|
|
|
|
|
return str(c.likeNum) |
|
|
|
|
|
|
|
@app.route('/ordinary/<int:id>/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) |
|
|
|