Skip to content

[audit] GenericForeignKey / GenericInlineModelAdmin support — verify or document the gap #628

@MartinCastroAlvarez

Description

@MartinCastroAlvarez

Adoption pain point

I couldn't find any wire handling for `GenericForeignKey` in the API package — no `ContentType`-aware field routing, no `object_id`+`content_type` pair handling.

A consumer with a `Comment` / `Attachment` / `ActivityLog` / `Tag` model that attaches to arbitrary parents via `GenericForeignKey` — the canonical Django pattern for cross-model attachments — probably hits an unsupported field shape.

Per the inline picture: `GenericInlineModelAdmin` is what surfaces "comments on this object" / "attachments on this object" in the legacy admin. If the SPA doesn't render generic inlines, consumers with attachment-pattern models lose every per-object surface that uses them.

What stock Django gets

`django.contrib.contenttypes.admin.GenericTabularInline` / `GenericStackedInline` ship with Django and render exactly like normal inlines. No special wiring required.

Suggested fix

Acceptance:

  1. `AccountAdmin` registers a `GenericTabularInline` for `Comment` (where Comment has a GFK to Account).
  2. The SPA detail page for an Account renders the Comment inline section.
  3. Adding / editing / removing a Comment from the inline writes the correct `(content_type, object_id)` pair.

If GFK is intentionally out of scope, document it prominently and recommend consumers either (a) replace GFK with explicit FKs per parent type, or (b) keep affected models on the legacy admin.

Filed by

Audit triage 2026-05-30.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions