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

Function index

examples/tutorial/flaskr/blog.py:17–25  ·  view source on GitHub ↗

Show all the posts, most recent first.

()

Source from the content-addressed store, hash-verified

15
16@bp.route("/")
17def index():
18 """Show all the posts, most recent first."""
19 db = get_db()
20 posts = db.execute(
21 "SELECT p.id, title, body, created, author_id, username"
22 " FROM post p JOIN user u ON p.author_id = u.id"
23 " ORDER BY created DESC"
24 ).fetchall()
25 return render_template("blog/index.html", posts=posts)
26
27
28def get_post(id, check_author=True):

Callers

nothing calls this directly

Calls 2

render_templateFunction · 0.90
get_dbFunction · 0.85

Tested by

no test coverage detected