DocManagerBackend/docmanager_backend/notifications/models.py

28 lines
744 B
Python
Raw Permalink Normal View History

2025-01-21 13:57:31 +08:00
from django.db import models
from django.utils.timezone import now
class Notification(models.Model):
client = models.ForeignKey(
"accounts.CustomUser", on_delete=models.CASCADE, null=True, blank=True)
timestamp = models.DateTimeField(default=now, editable=False)
content = models.TextField(max_length=512, blank=True, null=True)
AUDIENCE_CHOICES = (
("client", "Client"),
("staff", "Staff"),
("head", "Head")
)
TYPE_CHOICES = (
("info", "Info"),
("warning", "Warning"),
)
type = models.CharField(
max_length=16, choices=TYPE_CHOICES, default="info")
audience = models.CharField(
max_length=16, choices=AUDIENCE_CHOICES, default="staff")