28 lines
978 B
Python
28 lines
978 B
Python
from django.db import models
|
|
from django.utils.translation import gettext_lazy as _
|
|
from notifications.base.models import AbstractNotification
|
|
|
|
|
|
class NotificationType(models.TextChoices):
|
|
USER_INTERACTION = "USER_INTERACTION", _("User Interaction")
|
|
PROGRESS = "PROGRESS", _("Progress")
|
|
INFORMATION = "INFORMATION", _("Information")
|
|
|
|
|
|
class Notification(AbstractNotification):
|
|
# UUIDs are not supported by the notifications app...
|
|
# id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
|
|
|
|
notification_type = models.CharField(
|
|
max_length=32,
|
|
choices=NotificationType.choices,
|
|
default=NotificationType.INFORMATION,
|
|
)
|
|
target_url = models.URLField(blank=True, null=True)
|
|
actor_avatar_url = models.URLField(blank=True, null=True)
|
|
course = models.CharField(max_length=32, blank=True, null=True)
|
|
|
|
class Meta(AbstractNotification.Meta):
|
|
abstract = False
|
|
ordering = ["-timestamp"]
|