Add row-based multi-tenancy plumbing keyed on Club as the tenant root: - ClubTenantMiddleware maps the request's subdomain to a Club by slug, storing it on request.club and in a contextvar so service-layer code and management commands can read it via get_current_club(). Resolution honours CLUBMANAGER_BASE_DOMAIN (e.g. ajax-united.clubmanager.app), falling back to generic slug.example.com hosts, and ignores the bare base domain, www, and unknown slugs. - Club gains a unique slug (auto-derived from name on save) plus a ClubManager.current() accessor for the active tenant. - ClubScopedModel gets a TenantQuerySet (.for_club()/.current()) and auto-fills club from the active context on save. Contextvar helpers live in club.tenancy; Club is imported lazily there and in clubmanager.base to avoid an import cycle with club.models. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2.4 KiB
2.4 KiB