You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
konova/news/models.py

26 lines
793 B
Python

from django.db import models
from django.utils.translation import gettext_lazy as _
from konova.models import BaseResource
class ServerMessageImportance(models.TextChoices):
"""
Defines importance levels for server messages
"""
DEFAULT = "default", _("Default")
INFO = "info", _("Info")
WARNING = "warning", _("Warning")
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()
importance = models.CharField(max_length=100, choices=ServerMessageImportance.choices)