feat: Mise en place du Backend-messagerie [#17]

This commit is contained in:
Luc SORIGNET
2025-05-17 11:35:57 +02:00
parent fc9a1ed252
commit c6bc0d0b51
9 changed files with 291 additions and 188 deletions

View File

@ -1,15 +1,15 @@
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 Auth.models import Profile
class Messagerie(models.Model):
id = models.AutoField(primary_key=True)
objet = models.CharField(max_length=200, default="", blank=True)
emetteur = models.ForeignKey(Profile, on_delete=models.PROTECT, related_name='messages_envoyes')
destinataire = models.ForeignKey(Profile, on_delete=models.PROTECT, related_name='messages_recus')
corpus = models.CharField(max_length=200, default="", blank=True)
date_envoi = models.DateTimeField(auto_now_add=True) # Date d'envoi du message
is_read = models.BooleanField(default=False) # Statut lu/non lu
conversation_id = models.CharField(max_length=100, blank=True, default="") # Pour regrouper les messages par conversation
def __str__(self):
return 'Messagerie_'+self.id
return f'Messagerie_{self.id}'