Sistema de Notificaciones =========================== NoxPanel incluye un sistema de notificaciones in-app que informa a los usuarios sobre eventos relevantes en tiempo real. Características ---------------- - Notificaciones persistentes en base de datos - Badge con contador de no leídas en la barra lateral - Marcar como leída individual o todas a la vez - Preferencias de notificación por usuario - Template tag ``{% unread_notification_count %}`` para badges Modelo de Datos ---------------- .. code-block:: python class Notification(models.Model): recipient = models.ForeignKey(User) title = models.CharField(max_length=255) message = models.TextField() notification_type = models.CharField(choices=[ ('info', 'Información'), ('success', 'Éxito'), ('warning', 'Advertencia'), ('error', 'Error'), ]) is_read = models.BooleanField(default=False) created_at = models.DateTimeField(auto_now_add=True) URLs ----- - ``/notifications/`` — Lista de notificaciones - ``/notifications//read/`` — Marcar como leída - ``/notifications/read-all/`` — Marcar todas como leídas - ``/notifications/preferences/`` — Preferencias - ``/notifications/api/`` — API AJAX para obtener notificaciones Template Tag ------------- Para mostrar el badge de notificaciones no leídas en cualquier template: .. code-block:: html+django {% load notification_tags %} {% unread_notification_count as notif_count %} {% if notif_count > 0 %} {{ notif_count }} {% endif %}