Skip to content

fix: pass format_html() placeholder args instead of pre-built strings - #6

Open
hafkensite wants to merge 1 commit into
mainfrom
fix/format-html-no-args
Open

fix: pass format_html() placeholder args instead of pre-built strings#6
hafkensite wants to merge 1 commit into
mainfrom
fix/format-html-no-args

Conversation

@hafkensite

Copy link
Copy Markdown

Summary

  • Django's format_html() now raises TypeError: args or kwargs must be provided. when called with a single pre-formatted string and no placeholder args.
  • This broke every simple_tag that built HTML with an f-string first and passed it straight to format_html(): yes_no_img/no_yes_img (util), yes_no_button_repo_en/yes_no_button_repo_sec (repos), report_alert (hosts) — breaking the reports, repos, and hosts list pages in production.
  • Fixed all call sites to pass values as format_html placeholder args instead of pre-interpolating, which also restores proper autoescaping of those values.

Test plan

  • Load /reports/ and confirm the processed/not-processed icon column renders
  • Load a repos list page and confirm enable/security toggle buttons render and still work
  • Load a hosts list with an outdated report and confirm the alert icon renders

🤖 Generated with Claude Code

Django's format_html() now raises TypeError when called with no args/kwargs,
since a caller building the whole string themselves defeats its escaping
purpose. Affects every templatetag that used this pattern, breaking
report/repo/host list pages.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@hafkensite
hafkensite requested a review from cpoppema July 27, 2026 04:53
@hafkensite hafkensite self-assigned this Jul 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant