notification: add notification history
This commit is contained in:
@@ -1 +1,2 @@
|
||||
from .notification import *
|
||||
from .notification import *
|
||||
from .notification_history import *
|
||||
17
core/apps/notifications/models/notification_history.py
Normal file
17
core/apps/notifications/models/notification_history.py
Normal file
@@ -0,0 +1,17 @@
|
||||
from django.db import models
|
||||
|
||||
from core.apps.shared.models import BaseModel
|
||||
from core.apps.accounts.models import User
|
||||
|
||||
|
||||
class NotificationHistory(BaseModel):
|
||||
title = models.CharField(max_length=200)
|
||||
body = models.TextField()
|
||||
user = models.ForeignKey(
|
||||
User, on_delete=models.CASCADE, related_name='notification_histories'
|
||||
)
|
||||
is_read = models.BooleanField(default=False)
|
||||
data = models.JSONField(null=True, blank=True)
|
||||
|
||||
def __str__(self):
|
||||
return f'Notification to {self.user}: {self.title}'
|
||||
Reference in New Issue
Block a user