mirror of
https://git.v0id.ovh/n3wt-innov/n3wt-school.git
synced 2026-01-28 15:33:22 +00:00
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]
28 lines
1.0 KiB
Python
28 lines
1.0 KiB
Python
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
|
|
|
|
class TypeNotif(models.IntegerChoices):
|
|
NOTIF_NONE = 0, _('Aucune notification')
|
|
NOTIF_MESSAGE = 1, _('Un message a été reçu')
|
|
NOTIF_DI = 2, _('Le dossier d\'inscription a été mis à jour')
|
|
|
|
class Notification(models.Model):
|
|
user = models.ForeignKey(Profil, on_delete=models.PROTECT)
|
|
message = models.CharField(max_length=255)
|
|
is_read = models.BooleanField(default=False)
|
|
created_at = models.DateTimeField(auto_now_add=True)
|
|
typeNotification = models.IntegerField(choices=TypeNotif, default=0)
|
|
|
|
@property
|
|
def typeNotification_label(self):
|
|
return self.get_typeNotification_display()
|
|
|
|
def get_typeNotification_display(self):
|
|
return TypeNotif(self.typeNotification).label
|
|
|
|
def __str__(self):
|
|
return f'Notification for {self.user.username}'
|
|
|