Skip to content

feat(games): add Rapport model as typed atomic entry for Report#69

Open
RebelliousSmile wants to merge 1 commit intomainfrom
worktree-feat+rapport-typed-entries
Open

feat(games): add Rapport model as typed atomic entry for Report#69
RebelliousSmile wants to merge 1 commit intomainfrom
worktree-feat+rapport-typed-entries

Conversation

@RebelliousSmile
Copy link
Copy Markdown
Owner

Summary

  • Introduces Rapport — the atomic narrative element composing a Report, with four fixed types: description, action, discussion, narration
  • discussion type requires an existing Character as actor; all other types forbid actor — validated in Rapport.clean() bidirectionally
  • HTMX-first UI: inline form on the report detail page, conditional actor field via Alpine.js, delete without page reload

Changes

  • Model: Rapport(BaseModel) with RapportKind choices, clean() validation, migration 0010
  • Admin: RapportInline on ReportAdmin
  • Form: RapportForm with actor queryset scoped to the report's game
  • Views: rapport_create (GET+POST), rapport_edit, rapport_delete — all guarded by report.author == request.user
  • Templates: rapport_form.html (Alpine.js conditional actor + help link when no characters), partials/rapport_item.html (HTMX swap delete), report_detail.html updated
  • Tests: 13 tests — model validation (5) and view access control (8)
  • i18n: .po/.mo updated for fr/en

Test plan

  • Open a Report as author → "Ajouter un Rapport" button visible
  • Add a Description rapport → appears in list without reload
  • Add a Discussion rapport → actor dropdown filters to game characters only
  • Submit Discussion without actor → inline error, no insert
  • Game with no characters → help link to game detail page
  • Edit a Rapport → content updates correctly
  • Delete a Rapport → removed from DOM via HTMX
  • Non-author → 403 on create/edit/delete
  • make check → 271 passed, mypy clean, ruff clean

Closes #64

🤖 Generated with Claude Code

Introduces Rapport — the atomic narrative element composing a Report.
Each Rapport has a fixed type (description, action, discussion, narration);
discussion type requires an existing Character as actor.

- Model: Rapport(BaseModel) with RapportKind choices, clean() bidirectional
  validation (actor required for discussion, forbidden otherwise), migration 0010
- Admin: RapportInline on ReportAdmin
- Form: RapportForm with actor queryset scoped to report's game
- Views: rapport_create (GET+POST), rapport_edit, rapport_delete with HTMX partials
- Templates: rapport_form.html (Alpine.js conditional actor), rapport_item.html
  (HTMX swap delete), report_detail.html updated with rapports section
- Tests: 13 tests covering model validation and view access control
- i18n: .po/.mo updated for fr/en

Closes #64
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.

US-28 : Composer un compte rendu avec des Rapports typés

1 participant