forums app
Private threaded discussions per chapter, region, or org.
Models (5)
Forum— discussion space; FK to org or chapter; visibility (open / invite-only / approval-required)ForumMembership— joins User to Forum; role (member / moderator / admin)ForumPost— root post in a forum; title, body (markdown), pinned, lockedForumComment— reply to a postForumAttachment— uploaded file (image / PDF / doc);pre_signed_urlgenerated on read
Key endpoints
| URL | Purpose |
|---|---|
GET /api/forums/ | Forums I have access to |
POST /api/forums/ | Create a forum |
GET /api/forums/<id>/posts/ | Threads in a forum |
POST /api/forums/<id>/posts/ | New thread |
POST /api/forums/<id>/posts/<post_id>/comments/ | Reply |
POST /api/forums/<id>/posts/<post_id>/pin/ | Pin (mod only) |
POST /api/forums/<id>/posts/<post_id>/lock/ | Lock (mod only) |
POST /api/forums/<id>/posts/<post_id>/flag/ | User-flag for moderation |
Permissions
IsForumMemberOrAdmin(custom inapps/forums/permissions.py) — most read endpoints- Forum admins / moderators (per ForumMembership.role) — pin / lock / edit / remove
External integrations
- S3 / MinIO for attachment storage
Notable patterns
Visibility tiers
| Visibility | Who can join |
|---|---|
open | Anyone in the chapter / region / org auto-joins on first read |
invite_only | Admin must invite |
approval_required | User requests, mod approves |
Moderation rules
Org-level keyword + link rules in apps.organizations (configured via Settings → Moderation). On post submit, apps/forums/services/moderation.py runs the post against the rules:
- Match → flag for review (visible to mods, hidden from feed) OR block at submit (returns 422)
@mentions
Parser scans post body for @username, resolves to User via membership in the same chapter / org, creates Notification rows.
Per-thread subscriptions
ForumSubscription lives in apps.notifications (cross-app); flags whether a user gets pinged on new replies in a thread.
Code paths
- Models:
backend/apps/forums/models.py - Views:
backend/apps/forums/views.py - Permissions:
backend/apps/forums/permissions.py - Moderation service:
backend/apps/forums/services/moderation.py