from django.db import models from django.utils import timezone from datetime import datetime, timedelta from django.contrib.auth.models import User # Create your models here. ''' class UserNotification Model für Benachrichtigungen ''' class UserNotification(models.Model): # Wenn der User gelöscht wird, wird auch die Notification entfernt touser = models.ForeignKey(User, on_delete=models.CASCADE) notificationtype = models.CharField(max_length=60, blank=True) # Notifcaton was send or not (for sound-update at the client) wassend = models.BooleanField(default=False) # Wurde gesehen wasviewed = models.BooleanField(default=False) created = models.DateTimeField(default=timezone.now) elementid = models.IntegerField(default=None, null=True, blank=True) # Eventuell automatisches Lösch-Datum #willdeleted = models.DateTimeField(default=timezone.now()+timedelta(days=30)) # Textcontent notificationtext = models.CharField(max_length=200, blank=True)