mirror of
https://github.com/HamzaSha1/zod-backend.git
synced 2025-11-26 16:44:54 +00:00
notification set up and celery configuration
This commit is contained in:
@ -1,6 +1,24 @@
|
||||
"""
|
||||
notification models file
|
||||
"""
|
||||
# django imports
|
||||
from django.db import models
|
||||
from django.contrib.auth import get_user_model
|
||||
from django.utils import timezone
|
||||
|
||||
# Create your models here.
|
||||
USER = get_user_model()
|
||||
|
||||
|
||||
class Notification(models.Model):
|
||||
""" used to save the notifications """
|
||||
notification_type = models.CharField(max_length=50, blank=True, null=True)
|
||||
notification_to = models.ForeignKey(USER, related_name='to_notification', on_delete=models.CASCADE)
|
||||
notification_from = models.ForeignKey(USER, related_name='from_notification', on_delete=models.SET_NULL,
|
||||
blank=True, null=True)
|
||||
data = models.JSONField(default=dict, blank=True, null=True)
|
||||
is_read = models.BooleanField(default=False)
|
||||
created_at = models.DateTimeField(default=timezone.now)
|
||||
|
||||
def __str__(self):
|
||||
""" string representation """
|
||||
return f"{self.notification_to.id} | {self.notification_to.email}"
|
||||
|
||||
Reference in New Issue
Block a user