Improve admin page

This commit is contained in:
2024-07-01 17:41:51 +02:00
parent 219aee31af
commit 40587fa24f
11 changed files with 633 additions and 32 deletions

@ -1,5 +1,6 @@
from django.contrib.auth.models import User
from django.db import models
from simple_history.models import HistoricalRecords
from twitch_app.models import Game
@ -8,6 +9,7 @@ class DiscordSetting(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE)
name = models.CharField(max_length=255)
webhook_url = models.URLField()
history = HistoricalRecords()
disabled = models.BooleanField(default=False)
def __str__(self) -> str:
@ -18,6 +20,7 @@ class Subscription(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE)
game = models.ForeignKey(Game, on_delete=models.CASCADE)
created_at = models.DateTimeField(auto_now_add=True)
history = HistoricalRecords()
discord_webhook = models.ForeignKey(DiscordSetting, on_delete=models.CASCADE)
def __str__(self) -> str: