A post is a titled item of authored content published as part of a blog. It gathers the author, creation timestamp, update timestamp, title, and written content into one manageable unit. Registered users create posts, all users can view them, and users can comment on them. section 6.0 section 11.0
Treat a post as both user-facing content and an application resource:
- Create it through a URL handler, input form, and template; review the content before saving it to the database. section 11.5
- Display and edit individual posts alongside views that display multiple posts. section 11.6
- Store Markdown in the database as text and render it when displaying the post. section 11.7
- Attach comments through a self-referential post structure, allowing each post to have zero or many child posts. section 11.7
The same structure can represent both content posts and comments; comments mainly differ by lacking a title. A display handler retrieves the root post and its descendants, then renders them in meaningful hierarchical order. Recursive traversal processes each child until reaching a node without children, while a recursive common table expression supports the equivalent tree query in SQLAlchemy. section 11.7 section 11.7.2
Use the relationship diagram to follow a root content post through its nested comment posts and understand why the data forms a tree. section 11.7

