Skip to content

Add optional Project.display_short_name for compact artifact cards (#1156)#1382

Merged
jonfroehlich merged 1 commit into
masterfrom
1156-display-short-name
Jun 22, 2026
Merged

Add optional Project.display_short_name for compact artifact cards (#1156)#1382
jonfroehlich merged 1 commit into
masterfrom
1156-display-short-name

Conversation

@jonfroehlich

@jonfroehlich jonfroehlich commented Jun 22, 2026

Copy link
Copy Markdown
Member

Closes #1156.

Problem

Publication / talk / video cards show the project's full name in the flask "View project" chip, which is long and noisy for projects with descriptive titles (e.g. "Multi-Stakeholder Interviews to Address Urban Accessibility").

The existing Project.short_name can't be used for this — it's the URL slug (lowercase, no spaces, e.g. projectsidewalk), not a reader-facing label.

Change

  • New optional field Project.display_short_name — a short display label (e.g. "Urban Access"). Optional; when blank, rendering falls back to the full name.
  • New Project.get_display_short_name() centralizes that fallback (display_short_name or name).
  • Compact chips (display_pub_snippet, display_talk_snippet, display_video_snippet) now render get_display_short_name. The aria-label keeps the full name for screen readers; the link still uses the short_name slug.
  • Admin help text clarified on all three name fields so editors can tell them apart:
    • name — full title shown as the heading
    • display_short_name — optional short card label (blank = use full name)
    • short_name — lowercase/no-spaces URL slug, not shown to readers
  • display_short_name added to the Project admin form.

Bonus: slug-uniqueness guard

While here, added Project.clean() rejecting a short_name that collides case-insensitively with an existing project. The project view resolves /projects/<slug>/ via short_name__iexact, so a duplicate slug raises MultipleObjectsReturned — a 500 on both project pages. This is the form-level guard (mirrors the keyword-dedup approach); a DB-level unique constraint is deferred until prod data is confirmed de-duped (follow-up issue).

Before / After

Same publication card; the "before" state is reproduced by leaving display_short_name blank (the fallback path).

1156_beforeafter

Testing

  • python manage.py test website --settings=makeabilitylab.settings_test493 passed, 8 skipped.
  • New tests in test_project.py: get_display_short_name fallback (set / None / empty) and slug-uniqueness validation (case-insensitive, self-excluded on edit).
  • Verified on localhost: pub/talk/video chips render the short label, link uses the slug, aria-label keeps the full name; fallback confirmed on a project with no short name.

Notes

  • No migration committed (migrations are gitignored / per-environment); the field is nullable and the entrypoint generates the delta on container start.

🤖 Generated with Claude Code

…1156)

Publication/talk/video cards showed the project's full name in the flask
"View project" chip, which is long and noisy. Add an optional
display_short_name field (e.g. "Sidewalk" for "Project Sidewalk") and render
it on those three compact snippets via a new get_display_short_name() that
falls back to the full name when blank. aria-labels keep the full name.

Also clarify the help_text on all three name fields so the admin distinguishes
them: name (full title), display_short_name (optional short card label), and
short_name (lowercase, no-spaces URL slug).

While here, add a Project.clean() that rejects a short_name colliding
case-insensitively with an existing project's slug. The project view resolves
/projects/<slug>/ via short_name__iexact, so a duplicate slug raises
MultipleObjectsReturned (a 500) on both pages. This is the form-level guard;
a DB-level unique constraint is deferred until prod data is de-duped.

Tests: fallback behavior for get_display_short_name and slug-uniqueness
validation (case-insensitive, self-excluded on edit).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jonfroehlich jonfroehlich merged commit d4a90bc into master Jun 22, 2026
3 checks passed
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.

Show shortname for project in pub listing

1 participant