Refactor accounts app into authentication and club apps
- Split the accounts app into new authentication and club apps for better separation of concerns. - Migrate the custom User, Member, and Family models to the authentication app. - Introduce Club and ClubMembership models in the club app. - Refactor Family model to use UUID as the primary key and consolidate family-role relationships into a new FamilyMembership model. - Update tests, managers, and migrations to align with the new structure.
This commit is contained in:
21
clubmanager/base.py
Normal file
21
clubmanager/base.py
Normal file
@@ -0,0 +1,21 @@
|
||||
import uuid
|
||||
|
||||
from django.db import models
|
||||
|
||||
|
||||
class UUIDModel(models.Model):
|
||||
"""Abstract base class giving every model a UUID primary key"""
|
||||
|
||||
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
||||
|
||||
class ClubScopedModel(UUIDModel):
|
||||
"""Abstract base for entities owned by a single club (tenant root)."""
|
||||
|
||||
club = models.ForeignKey("club.Club", on_delete=models.CASCADE, related_name="%(class)ss")
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
Reference in New Issue
Block a user