mirror of
https://git.v0id.ovh/n3wt-innov/n3wt-school.git
synced 2026-01-28 23:43:22 +00:00
refactor: Traduction en anglais des modules "GestionInscription" et
"GestionLogin"
This commit is contained in:
@ -2,7 +2,7 @@ from django.contrib.auth.models import AbstractUser
|
||||
from django.db import models
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from django.conf import settings
|
||||
from GestionLogin.models import Profil
|
||||
from Auth.models import Profile
|
||||
|
||||
class TypeNotif(models.IntegerChoices):
|
||||
NOTIF_NONE = 0, _('Aucune notification')
|
||||
@ -10,7 +10,7 @@ class TypeNotif(models.IntegerChoices):
|
||||
NOTIF_DI = 2, _('Le dossier d\'inscription a été mis à jour')
|
||||
|
||||
class Notification(models.Model):
|
||||
user = models.ForeignKey(Profil, on_delete=models.PROTECT)
|
||||
user = models.ForeignKey(Profile, on_delete=models.PROTECT)
|
||||
message = models.CharField(max_length=255)
|
||||
is_read = models.BooleanField(default=False)
|
||||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
|
||||
@ -2,7 +2,7 @@ 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
|
||||
from Subscriptions.models import RegistrationForm
|
||||
|
||||
@receiver(post_save, sender=Messagerie)
|
||||
def notification_MESSAGE(sender, instance, created, **kwargs):
|
||||
@ -13,11 +13,11 @@ def notification_MESSAGE(sender, instance, created, **kwargs):
|
||||
typeNotification=TypeNotif.NOTIF_MESSAGE
|
||||
)
|
||||
|
||||
@receiver(post_save, sender=FicheInscription)
|
||||
@receiver(post_save, sender=RegistrationForm)
|
||||
def notification_DI(sender, instance, created, **kwargs):
|
||||
for responsable in instance.eleve.responsables.all():
|
||||
for responsable in instance.student.guardians.all():
|
||||
Notification.objects.create(
|
||||
user=responsable.profilAssocie,
|
||||
user=responsable.associated_profile,
|
||||
message=(TypeNotif.NOTIF_DI).label,
|
||||
typeNotification=TypeNotif.NOTIF_DI
|
||||
)
|
||||
|
||||
@ -3,7 +3,7 @@ from rest_framework.views import APIView
|
||||
|
||||
from .models import *
|
||||
|
||||
from GestionInscriptions.serializers import NotificationSerializer
|
||||
from Subscriptions.serializers import NotificationSerializer
|
||||
|
||||
from N3wtSchool import bdd
|
||||
|
||||
|
||||
Reference in New Issue
Block a user