2021-07-06 08:53:08 +02:00
|
|
|
from django.db import models
|
2021-08-03 17:22:41 +02:00
|
|
|
from django.utils.translation import gettext_lazy as _
|
2021-07-06 08:53:08 +02:00
|
|
|
|
|
|
|
from konova.models import BaseResource
|
|
|
|
|
|
|
|
|
2021-08-03 17:22:41 +02:00
|
|
|
class ServerMessageImportance(models.TextChoices):
|
|
|
|
"""
|
|
|
|
Defines importance levels for server messages
|
|
|
|
"""
|
|
|
|
DEFAULT = "default", _("Default")
|
|
|
|
INFO = "info", _("Info")
|
|
|
|
WARNING = "warning", _("Warning")
|
|
|
|
|
|
|
|
|
2021-07-06 08:53:08 +02:00
|
|
|
class ServerMessage(BaseResource):
|
|
|
|
"""
|
|
|
|
Holds messages, which can be displayed on the user's dashboard
|
|
|
|
"""
|
|
|
|
subject = models.CharField(max_length=500, null=False, blank=False)
|
|
|
|
body = models.TextField()
|
|
|
|
is_active = models.BooleanField(default=True)
|
|
|
|
publish_on = models.DateTimeField()
|
|
|
|
unpublish_on = models.DateTimeField()
|
2021-08-03 17:22:41 +02:00
|
|
|
importance = models.CharField(max_length=100, choices=ServerMessageImportance.choices)
|