MCPcopy
hub / github.com/pallets/flask / delete

Function delete

examples/tutorial/flaskr/blog.py:115–125  ·  view source on GitHub ↗

Delete a post. Ensures that the post exists and that the logged in user is the author of the post.

(id)

Source from the content-addressed store, hash-verified

113@bp.route("/<int:id>/delete", methods=("POST",))
114@login_required
115def delete(id):
116 """Delete a post.
117
118 Ensures that the post exists and that the logged in user is the
119 author of the post.
120 """
121 get_post(id)
122 db = get_db()
123 db.execute("DELETE FROM post WHERE id = ?", (id,))
124 db.commit()
125 return redirect(url_for("blog.index"))

Callers

nothing calls this directly

Calls 4

redirectFunction · 0.90
url_forFunction · 0.90
get_postFunction · 0.85
get_dbFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…