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:
Luc SORIGNET
2024-11-18 10:02:58 +01:00
committed by N3WT DE COMPET
commit af0cd1c840
228 changed files with 22694 additions and 0 deletions

View File

@ -0,0 +1 @@
default_app_config = 'GestionNotification.apps.GestionNotificationConfig'

View File

@ -0,0 +1,3 @@
from django.contrib import admin
# Register your models here.

View File

@ -0,0 +1,9 @@
from django.apps import AppConfig
class GestionNotificationConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'GestionNotification'
def ready(self):
import GestionNotification.signals

View File

@ -0,0 +1,28 @@
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}'

View 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
)

View File

@ -0,0 +1,7 @@
from django.urls import path, re_path
from GestionNotification.views import NotificationView
urlpatterns = [
re_path(r'^notification$', NotificationView.as_view(), name="notification"),
]

View File

@ -0,0 +1,15 @@
from django.http.response import JsonResponse
from rest_framework.views import APIView
from .models import *
from GestionInscriptions.serializers import NotificationSerializer
from N3wtSchool import bdd
class NotificationView(APIView):
def get(self, request):
notifsList=bdd.getAllObjects(Notification)
notifs_serializer=NotificationSerializer(notifsList, many=True)
return JsonResponse(notifs_serializer.data, safe=False)