Pero Grubač

Minimal Blog

Django blog with drafts, publishing and moderated comments.

Minimal Blog: a post with edit and delete buttons and two comments, one of them waiting for approval

What it does

The blog has two kinds of users. Visitors don’t sign in: they read the published posts, listed newest first on the home page, see the approved comments and leave their own, with a name and a text. An author signs in with a username and password and can also write, edit, publish and delete posts, see the drafts, and approve or remove comments.

Posts are written in the Medium Editor, a rich-text editor whose toolbar appears when text is selected, with bold, italic, headings, links and quotes. Saving a new post keeps it as a draft, and one click publishes it. A new comment stays hidden from visitors until it is approved: a signed-in author sees it on the post with buttons to approve or remove it, and once approved it is visible to everyone and counted on the home page. Posts, comments and users can also be managed in the Django admin.

Decisions and why

  • A draft is a post without a publish date. There is no separate status field, and the home page only shows posts whose date is in the past.
  • Comments are open, moderation is not. Anyone can comment, but only signed-in users see unapproved comments and can approve or remove them.
  • One settings file, configured by the environment. The same code runs on SQLite locally and on PostgreSQL 16 in Docker and CI.

Security

  • Changes only through POST. Publishing, approving and removing are forms with a CSRF token, so a link or a crawler can’t trigger them.
  • Untrusted text is never rendered as HTML. Posts, written by signed-in authors, keep the editor’s formatting; comments from visitors are always escaped.
  • The author of a post is always the signed-in user. The post form has no author field.
  • Drafts are private. Only signed-in users can see them.

Testing and deployment

90 tests, at 99% coverage, cover the models, the forms, the post and comment views and the other pages, including the sign-in rules, draft privacy, HTML escaping in comments and POST-only actions.

GitHub Actions runs on every push to main and every pull request. It lints with Ruff, runs Django’s system checks and fails if a model change is missing a migration. Then it runs the whole suite on SQLite and on PostgreSQL, with coverage that must stay at 90% or more. Last, it builds the Docker image, starts the app and PostgreSQL with Docker Compose, and checks that the home page answers. In Docker the app applies its migrations when it starts.

HomepageAboutsectionSystemssectionIndex of projectssectionBrowser appspageContactsectionIncident Alertsystem · case studyeMobilityHubsystem · case studyChat Roomsystem · case studyOnline Library Systemsystem · case studyRepoHealthlive app · case studyOpen RepoHealth app (opens in a new tab)live appGitHub Discord Bottool · case studyBookstore APIweb project · case studyFitForgemobile app · case studyAssetManagermobile app · case studyStore Managementdesktop app · case studyETF Oglasimobile app · case studyDevKitlive app · case studyOpen DevKit app (opens in a new tab)live appDev Timelinelive app · case studyOpen Dev Timeline app (opens in a new tab)live appGitHub Dashboardlive app · case studyOpen GitHub Dashboard app (opens in a new tab)live appStore Chain Managementdesktop app · case studySecure Repositorytool · case studyMinimal Blogweb project · case studyCatan Map Generatorlive app · case studyOpen Catan Map Generator app (opens in a new tab)live appMonte Carlo π · Pythonlive app · case studyOpen Monte Carlo π · Python app (opens in a new tab)live appBrick Breakerlive app · case studyOpen Brick Breaker app (opens in a new tab)live appArcane Keeplive app · case studyOpen Arcane Keep app (opens in a new tab)live appe-Mobility Rentaldesktop app · case studyCountdownlive app · case studyOpen Countdown app (opens in a new tab)live appANOVAdesktop app · case studyEcho Playerdesktop app · case studyMonte Carlo πdesktop app · case studyexcuse.exelive app · case studyOpen excuse.exe app (opens in a new tab)live appYamb Tablelive app · case studyOpen Yamb Table app (opens in a new tab)live appSedmicalive app · case studyOpen Sedmica app (opens in a new tab)live appLora Score Tablelive app · case studyOpen Lora Score Table app (opens in a new tab)live appSnake (Blavor)desktop app · case study
Copy emailpero.grubac00@gmail.com