Story #2610 :: Task: Explain the badges admin on the page where it is administered - #2615
Open
herzog0 wants to merge 2 commits into
Open
Story #2610 :: Task: Explain the badges admin on the page where it is administered #2615herzog0 wants to merge 2 commits into
herzog0 wants to merge 2 commits into
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
8 tasks
herzog0
force-pushed
the
teo/badges-docs
branch
from
August 13, 2026 14:44
bce924d to
8d44a29
Compare
herzog0
force-pushed
the
teo/badges-docs
branch
from
August 14, 2026 15:26
8d44a29 to
631296b
Compare
Base automatically changed from
teo/2486-badge-profile-display
to
teo/2541-release-pipeline-backfill
August 14, 2026 15:27
herzog0
force-pushed
the
teo/badges-docs
branch
from
August 14, 2026 19:57
631296b to
4221953
Compare
herzog0
force-pushed
the
teo/badges-docs
branch
from
August 14, 2026 20:07
4221953 to
f24d935
Compare
herzog0
force-pushed
the
teo/badges-docs
branch
from
August 17, 2026 16:32
f24d935 to
38a5142
Compare
herzog0
force-pushed
the
teo/badges-docs
branch
2 times, most recently
from
August 17, 2026 20:21
b75c097 to
d5b11e6
Compare
herzog0
force-pushed
the
teo/badges-docs
branch
from
August 17, 2026 23:06
d5b11e6 to
92a8a57
Compare
herzog0
force-pushed
the
teo/badges-docs
branch
from
August 18, 2026 14:28
92a8a57 to
13f8a1f
Compare
11 tasks
herzog0
force-pushed
the
teo/badges-docs
branch
from
August 21, 2026 14:48
13f8a1f to
f950c33
Compare
fix: drop the award email claim from the badges admin docs fix: use the admin border variable in the docs stylesheet
herzog0
force-pushed
the
teo/badges-docs
branch
from
August 24, 2026 13:40
f950c33 to
dd86bc8
Compare
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.
Issue: #2610
teo/2486-badge-profile-displaySummary & Context
The badges section's landing page was a bare list of model links. It now opens with a reference to the
whole section: what each page is for, what each of the seven operations does and when to run it, why
tiers are retired rather than edited, and how cascade and manual revocation differ.
The copy lives in
docs/badges-admin.mdand is rendered on the page, so there is one text rather than arepo file and an admin page drifting apart. It goes through
core.markdown.process_md- the samepipeline
MarkdownTemplateViewuses for the site's markdown pages - so no new rendering machinery.This is the last PR in the stack on purpose: it describes six pages and seven operations, all of which
have to exist before they can be described.
localhost:8000/admin/badges/Changes
docs/badges-admin.md- the reference. Four sections: the pages in the section, the operations andwhen to run each, changing a badge's tiers, and how revocation works. The operations and revocation
sections are tables because the useful thing about them is the comparison - backfill against reconcile,
invalidate against revoke, cascade against manual.
docs/README.md- one index line, noting the file is also rendered on/admin/badges/.badges/templatetags/badges_docs.py-render_badges_docs, which reads the file and returns therendered HTML. Twelve lines; it exists so the copy stays in a markdown file instead of a template.
badges/templates/admin/badges/app_index.html- overrides the badges section'sapp_index, retitlesit, links the stylesheet, and renders the docs above
{{ block.super }}so the model list isunchanged and still there.
static/css/admin/admin-docs.css- keyed off.admin-docs, not off the badges app, so a secondsection can reuse it without a rename. Drops the dashboard's narrow column and the 300px sidebar
margin, and undoes the admin's single-line table cells, which clip a reference table. Colours are the
admin's own variables so both themes follow.
badges/tests/test_admin_docs.py- four tests: the page renders the docs, the model links survive, thestylesheet is linked, and the markdown is rendered rather than dumped (asserting on
<table>,<blockquote>, a heading element and a<code>span - a raw file dump passes anin bodycheck, sothat one has to assert on the HTML).
Read the copy as assertions, not prose. This page will be trusted for exactly the decisions where
being wrong is expensive - which button deletes grants, whether a revoked badge can come back. Two
defects were caught that way while preparing this and are fixed in the branch:
member "if they opted into award emails". Badge award emails were dropped from the phase; there is no
such code and no such preference anywhere in
badges/,users/,core/or the templates. Both nowsay plainly that nothing in this section notifies anybody, which is what the code does.
var(--border)is not a Django adminvariable (it is
--border-color), so the declaration was invalid at computed-value time and the leftrule fell back to
currentColor- text colour instead of a hairline, in both themes. Everyvar()inthe stylesheet was then checked against Django's
base.css; the remaining three are defined.Finding (1) is the argument for a second reader on the operations and revocation tables specifically:
a wrong sentence there is indistinguishable from a right one without checking the code.
It will go stale, and the tests will not catch it. They pin that the page renders and that the four
section headings are present; nothing pins that the sentences are still true. A behaviour change in the
badges engine or admin is not finished until this file still reads correctly.
No caching - the file is read and rendered per request. Deliberate: editing the file updates the page
with no deploy-time step, and it is a staff-only page serving a small file. The cost is that a missing
file raises rather than degrading, so
test_docs_file_is_present_and_renders_as_markdownis what stops arename from shipping.
Everything else is additive. No models, no migrations, no change to badge behaviour, and no template
outside
badges/templates/admin/badges/. Theapp_indexoverride is scoped to the badges app only, sono other admin section is affected.
Minor: the CSS uses
:has(), so on a browser without it the landing page keeps the dashboard'snarrow column. The page is still readable; it is just narrower.
Screenshots
/admin/badges/- model links onlyPeer-review testing steps
Setup:
docker compose up,just migrate, and log in as a superuser. No data is needed - this PRrenders a file.
/admin/badges/. It opens with Badges - how this section works and four sections:the pages table, the operations table, changing a badge's tiers, and how revocation works. Tables span
the full width and their cells wrap over several lines rather than clipping to one.
Badges, User achievements, User badges and Achievement sync runs all navigate. Badge tiers is absent
from it, which is the admin's own choice from an earlier PR, not this one - the docs say so and point
at the badge page's retired-tier link instead.
docs/badges-admin.md, reload the page. It changes with norestart and no template edit. Revert.
its left rule all follow, because they use the admin's own variables.
Reconcile previews before it removes and Backfill has no such preview; that Reinstate refuses a
cascade-revoked badge; that editing a threshold on the Badge page leaves the old tier on the Badge
tiers page rather than deleting it. This is the review that matters here, and it is the one the tests
cannot do.
/admin/and any other app's index look exactly as before. The templateoverride lives under
badges/templates/admin/badges/, so it applies to this section alone.Self-review Checklist
Backend
behaviour