Backend Draft

This commit is contained in:
__init__
2026-02-23 20:31:53 +05:30
commit eec700af51
127 changed files with 2356 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
from django.db import models
from django.conf import settings
from tenants.managers import TenantScopedManager
from tenants.models import Tenant
class Notification(models.Model):
tenant = models.ForeignKey(Tenant, on_delete=models.CASCADE, related_name='notifications')
user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE, related_name='notifications')
title = models.CharField(max_length=255)
message = models.TextField()
is_read = models.BooleanField(default=False)
link = models.URLField(max_length=500, null=True, blank=True)
created_at = models.DateTimeField(auto_now_add=True)
objects = TenantScopedManager()
class Meta:
ordering = ['-created_at']
indexes = [
models.Index(fields=['tenant', 'user', 'is_read']),
]
def __str__(self):
return f"Notification for {self.user}: {self.title}"