Files
2025-03-09 16:22:28 +01:00

24 lines
930 B
Python

from django.db.models.signals import post_save
from django.dispatch import receiver
from .models import Notification, TypeNotif
from GestionMessagerie.models import Messagerie
from Subscriptions.models import RegistrationForm
# @receiver(post_save, sender=Messagerie)
# def notification_MESSAGE(sender, instance, created, **kwargs):
# if created:
# Notification.objects.create(
# user=instance.destinataire,
# message=(TypeNotif.NOTIF_MESSAGE).label,
# typeNotification=TypeNotif.NOTIF_MESSAGE
# )
# @receiver(post_save, sender=RegistrationForm)
# def notification_DI(sender, instance, created, **kwargs):
# for responsable in instance.student.guardians.all():
# Notification.objects.create(
# user=responsable.associated_profile,
# message=(TypeNotif.NOTIF_DI).label,
# typeNotification=TypeNotif.NOTIF_DI
# )