MCPcopy Create free account
hub / github.com/Dispatcharr/Dispatcharr / NotificationDismissal

Class NotificationDismissal

core/models.py:609–636  ·  view source on GitHub ↗

Tracks which users have dismissed which notifications. Allows users to dismiss notifications once without seeing them again.

Source from the content-addressed store, hash-verified

607
608
609class NotificationDismissal(models.Model):
610 """
611 Tracks which users have dismissed which notifications.
612 Allows users to dismiss notifications once without seeing them again.
613 """
614 user = models.ForeignKey(
615 settings.AUTH_USER_MODEL,
616 on_delete=models.CASCADE,
617 related_name='dismissed_notifications'
618 )
619 notification = models.ForeignKey(
620 SystemNotification,
621 on_delete=models.CASCADE,
622 related_name='dismissals'
623 )
624 dismissed_at = models.DateTimeField(auto_now_add=True)
625
626 # Optional: track if user accepted/applied the recommendation
627 action_taken = models.CharField(max_length=50, blank=True, null=True)
628
629 class Meta:
630 unique_together = ['user', 'notification']
631 indexes = [
632 models.Index(fields=['user', 'notification']),
633 ]
634
635 def __str__(self):
636 return f"{self.user.username} dismissed {self.notification.notification_key}"

Callers 1

dismiss_allMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected