mirror of
https://git.v0id.ovh/n3wt-innov/n3wt-school.git
synced 2026-01-28 23:43:22 +00:00
chore: Initial Commit
feat: Gestion des inscriptions [#1] feat(frontend): Création des vues pour le paramétrage de l'école [#2] feat: Gestion du login [#6] fix: Correction lors de la migration des modèle [#8] feat: Révision du menu principal [#9] feat: Ajout d'un footer [#10] feat: Création des dockers compose pour les environnements de développement et de production [#12] doc(ci): Mise en place de Husky et d'un suivi de version automatique [#14]
This commit is contained in:
23
Back-End/GestionNotification/signals.py
Normal file
23
Back-End/GestionNotification/signals.py
Normal file
@ -0,0 +1,23 @@
|
||||
from django.db.models.signals import post_save
|
||||
from django.dispatch import receiver
|
||||
from .models import Notification, TypeNotif
|
||||
from GestionMessagerie.models import Messagerie
|
||||
from GestionInscriptions.models import FicheInscription
|
||||
|
||||
@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=FicheInscription)
|
||||
def notification_DI(sender, instance, created, **kwargs):
|
||||
for responsable in instance.eleve.responsables.all():
|
||||
Notification.objects.create(
|
||||
user=responsable.profilAssocie,
|
||||
message=(TypeNotif.NOTIF_DI).label,
|
||||
typeNotification=TypeNotif.NOTIF_DI
|
||||
)
|
||||
Reference in New Issue
Block a user