feat: add events app + "multi-tenants" aka multi-events

This commit is contained in:
2026-09-16 00:03:26 +02:00
parent b5c2cdc037
commit 8b9c254fd2
62 changed files with 1343 additions and 362 deletions
+21
View File
@@ -8,6 +8,9 @@ from django.db.models.expressions import Window
from django.db.models.functions import Cast, Rank, RowNumber
from django.db.models.query import F
from events.models import Event
from events.scoping import EventScopedManager
User = get_user_model()
@@ -108,6 +111,12 @@ class SteamAPIKey(models.Model):
class SteamCollection(models.Model):
"""Model representing a Steam Workshop collection"""
event = models.ForeignKey(
Event,
on_delete=models.CASCADE,
related_name="steam_collections",
)
# Basic collection info
steam_id = models.CharField(
max_length=50, unique=True, help_text="Steam collection ID from URL"
@@ -164,6 +173,9 @@ class SteamCollection(models.Model):
blank=True, help_text="Last error encountered when fetching data"
)
objects = models.Manager()
for_event = EventScopedManager()
class Meta:
ordering = ["-created_at"]
verbose_name = "Steam Collection"
@@ -257,6 +269,12 @@ class Submission(models.Model):
# Identification
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
event = models.ForeignKey(
Event,
on_delete=models.CASCADE,
related_name="opus_magnum_submissions",
)
# User information (optional for anonymous submissions)
user = models.ForeignKey(
User,
@@ -299,6 +317,9 @@ class Submission(models.Model):
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
objects = models.Manager()
for_event = EventScopedManager()
class Meta:
ordering = ["-created_at"]
verbose_name = "Submission"