Add aggregator service choices

This commit is contained in:
Mark Veidemanis 2023-03-06 21:11:17 +00:00
parent 34146a0bd1
commit 20b4f101a2
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
1 changed files with 10 additions and 3 deletions

View File

@ -1,7 +1,5 @@
import uuid
from datetime import timedelta
from django.conf import settings
from django.contrib.auth.models import AbstractUser
from django.db import models
@ -10,6 +8,8 @@ from core.util import logs
log = logs.get_logger(__name__)
SERVICE_CHOICES = (("nordigen", "Nordigen"),)
class User(AbstractUser):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
@ -22,9 +22,16 @@ class User(AbstractUser):
class NotificationSettings(models.Model):
user = models.OneToOneField(User, on_delete=models.CASCADE)
user = models.ForeignKey(User, on_delete=models.CASCADE)
ntfy_topic = models.CharField(max_length=255, null=True, blank=True)
ntfy_url = models.CharField(max_length=255, null=True, blank=True)
def __str__(self):
return f"Notification settings for {self.user}"
class Aggregator(models.Model):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
user = models.ForeignKey(User, on_delete=models.CASCADE)
name = models.CharField(max_length=255)
service = models.CharField(max_length=255, choices=SERVICE_CHOICES)