fix(api): interpolate %(verbose_name_plural)s in action labels#204
Merged
Conversation
Django's built-in `delete_selected` (and any action whose
`short_description` uses the admin's `%(verbose_name)s` /
`%(verbose_name_plural)s` placeholders) ships a *format string* that
Django interpolates at render time via `model_format_dict(opts)`. The
SPA's `actions_payload` surfaced it raw, so the Actions dropdown showed
"Delete selected %(verbose_name_plural)s" instead of "Delete selected
files".
`actions_payload` now runs the label through `raw_label % fmt` where
`fmt = model_format_dict(model._meta)`, with a try/except that surfaces
the label verbatim for non-format strings / unknown keys (never 500s).
Test: `test_delete_selected_label_is_interpolated` — the delete_selected
label contains no `%(` placeholder and includes the model plural.
Repo-owner report ("what is verbose names?" — the raw placeholder leaked
to the UI).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Owner
Author
MartinCastroAlvarez
left a comment
There was a problem hiding this comment.
Security lane: Approve. Pure label-formatting fix — interpolates Django action format strings via model_format_dict; try/except never 500s; no security/permission surface. Test added; isolated. APPROVE.
Owner
Author
MartinCastroAlvarez
left a comment
There was a problem hiding this comment.
Architect lane: Approve. Pure label-formatting fix — interpolates Django action format strings via model_format_dict; try/except never 500s; no security/permission surface. Test added; isolated. APPROVE.
MartinCastroAlvarez
pushed a commit
that referenced
this pull request
May 26, 2026
Ships the batch merged since 0.2.0a2: - SECURITY: SW message-handler origin check (#208, CodeQL js/missing-origin-check) — the artifact's service worker now rejects cross-origin cache-control messages. - PWA backend serving (#200), React login form end-to-end (#190), create/Add form completing CRUD (#199), autocomplete FK widget (#207), date_hierarchy drill-down (#205), action-label + list cosmetics fixes (#203/#204), lint cleanup (#202). 368 tests pass. Tier 6 — version bump; publish via the Security deploy-gate under the standing "deploy regularly if secure" directive. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
MartinCastroAlvarez
added a commit
that referenced
this pull request
May 26, 2026
Ships the batch merged since 0.2.0a2: - SECURITY: SW message-handler origin check (#208, CodeQL js/missing-origin-check) — the artifact's service worker now rejects cross-origin cache-control messages. - PWA backend serving (#200), React login form end-to-end (#190), create/Add form completing CRUD (#199), autocomplete FK widget (#207), date_hierarchy drill-down (#205), action-label + list cosmetics fixes (#203/#204), lint cleanup (#202). 368 tests pass. Tier 6 — version bump; publish via the Security deploy-gate under the standing "deploy regularly if secure" directive. Co-authored-by: Martin Castro Laminrs <mcastro@laminr.ai> Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug: the Actions dropdown showed "Delete selected %(verbose_name_plural)s" —
actions_payloadsurfaced Django's rawshort_descriptionformat string without interpolating it (Django does this viamodel_format_dictat render time). Nowraw_label % model_format_dict(model._meta)with a try/except fallback (never 500s). Test added. Tier 3, isolated label fix; test_actions + lint pass.Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com