Django admin¶
Status: Placeholder — to be developed. Last reviewed: — Reference structural sibling:
guidelines/ui/forms.md(component-style sectioning).
Scope (when this guideline lands)¶
When to register a model in Django admin (and when not), list_display / list_filter / search_fields conventions, inlines, custom admin actions, read-only vs editable fields for audit-sensitive models, how admin coexists with the user-facing CRUD UI, who can access admin (the roadmap/done/website-pages-audit.md decision: superuser-only).
Out of scope (cross-refs)¶
- Multi-tenant queryset scoping in admin →
guidelines/security/multi-tenant-isolation.md(placeholder). Default Django admin doesn't honour app-level practice scoping; document the rule. - Display strings (
short_description, action labels,list_filtertitles) →guidelines/i18n/translation-rules.md(French source). - Website-side CRUD UI (the user-facing equivalent that admin is being demoted in favour of) →
guidelines/ui/lists.md,forms.md,detail-pages.md. - Field conventions on the underlying model →
guidelines/backend/models.md(placeholder).
Sources to mine when writing this¶
apps/*/admin.pyacross the project — survey what's registered and what's not. Especiallyapps/practices/admin.py(rich inlines perroadmap/done/website-pages-audit.md),apps/entities/admin.py(curated).roadmap/done/website-pages-audit.md— Section 1 ("Recommendation: Website > Admin") and Section 2 (data coverage gaps). The decision to demote admin to superuser-only debugging is binding.apps/accounts/admin.py— User admin customisation.- Django docs on
ModelAdmin(reference, link don't quote).
Starter hard rules to investigate¶
- Admin is superuser-only per
website-pages-audit.mddecision. Don't grantis_staffto non-superusers. list_displaymax ~8 columns — admin is for debugging, not high-density data review (use website list pages for that).- Inlines for ≤ 10 children; for more, link to a separate admin page (admin inlines get clunky at scale).
- All registered models have
search_fieldsandlist_filter— debugging requires fast lookup. - No business logic in admin actions — call the same services the website views call.
Decision points to settle¶
- Which models stop being admin-managed entirely? Per
website-pages-audit.mdSection 1, "stop investing in admin fieldsets/inlines." Define what minimum admin coverage looks like. - Custom admin themes: any project-specific styling? Currently default Django.
- Admin actions for one-off data fixes vs management commands: pick a default.
- History tracking:
django-simple-historyor custom AuditModel? Coordinate withbackend/models.md.
Known deviations to look for during writing¶
- Heavy admin pages with 20+ list_display columns (signal: admin is doing UI work that should be on the website).
- Admin actions performing business logic inline.
- Models registered in admin but not on website (gap from the
website-pages-audit.mdSection 2 inventory — most cleared, verify).
If found, file as roadmap/backlog/backend-admin-drift-2026-MM.md.