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

Function delete

examples/tutorial/flaskr/blog.py:115–125  ·  examples/tutorial/flaskr/blog.py::delete

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