from django.db import models from accounts.models import User class Notification(models.Model): NOTIFICATION_TYPES = [ ('event', 'Event'), ('promo', 'Promotion'), ('system', 'System'), ('booking', 'Booking'), ] user = models.ForeignKey(User, on_delete=models.CASCADE, related_name='notifications') title = models.CharField(max_length=255) message = models.TextField() notification_type = models.CharField(max_length=20, choices=NOTIFICATION_TYPES, default='system') is_read = models.BooleanField(default=False) action_url = models.URLField(blank=True, null=True) created_at = models.DateTimeField(auto_now_add=True) class Meta: ordering = ['-created_at'] def __str__(self): return f"{self.notification_type}: {self.title} → {self.user.email}"