Skip to content

Admin changelist audit: make all listing pages manageable (perf + findability) #1346

@jonfroehlich

Description

@jonfroehlich

Follow-up to #1082 (banner admin). A deep-dive audit of all 16 model-admin changelist (list) pages surfaced two cross-cutting themes plus several latent bugs. This issue tracks the multi-phase cleanup.

Theme 1 — N+1 query performance (biggest impact)

Many changelists have callable columns (counts, author lists, "most recent artifact", thumbnails) that hit the DB per row, with no select_related/prefetch_related/annotate, and most inherit Django's default 100 rows/page.

  • ProjectAdmin — ~10 DB-touching callable columns; a full list page can fire 1,000+ queries.
  • PersonAdmin — 14 columns, nearly all reverse-relation walks; PositionRoleListFilter also loops over every Person on every request.
  • Publication/Talk/Poster/Video/Grant/Award have M2M/FK callables (authors, projects, sponsor, recipients) with no prefetch.

Theme 2 — findability gaps

  • News and Keyword had no search box at all.
  • Could not search Publications/Talks/Posters by author name.
  • Several admins had no default ordering (Poster, Project, Sponsor, Keyword, ProjectUmbrella).
  • date_hierarchy absent on every date-driven model.

Latent bugs

  • NewsAdmin.get_display_thumbnail was not exception-guarded → one corrupt image 500s the whole News changelist.
  • PhotoAdmin.get_resolution_as_str reads image dimensions per row and raises if the file is missing.

Phased plan

  • Phase 1 — quick wins + bug fixes (this PR): News thumbnail crash fix, missing search_fields (incl. author search), fixed DateField string-searches, missing ordering, date_hierarchy on date models. Config-only, no query-shape changes.
  • Phase 2 — N+1 perf on Project & Person: get_queryset annotations + prefetch, page-size caps, verified with before/after query counts.
  • Phase 3 — N+1 perf on the artifact family: list_prefetch_related/list_select_related on Publication/Talk/Poster/Video/Grant/Award.
  • Phase 4 — workflow niceties: list_editable inline toggles, bulk actions (project visibility, BibTeX export), Keyword cleanup tooling (unused-tag filter, broaden usage counts, merge action), Photo project column + guard get_resolution_as_str.

Admin pages are not Pa11y-scanned and these touch no models/migrations.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions