text: from django.db import models
  from  account.models import User
  from django.utils.text import slugify
  
  # Create your models here.
  """
  ---> module.py
      +   User
      +   Sujet
      +   Room
      +   Message
  """
  
  
  class Sujet(models.Model):
      name = models.CharField(max_length=200)
  
      def __str__(self):
          return self.name
  
  
  class Room(models.Model):
      auther = models.ForeignKey(User, on_delete=models.SET_NULL, null=True)
      sujet = models.ForeignKey(Sujet, on_delete=models.SET_NULL, null=True)
      name = models.CharField(max_length=200)
      description = models.TextField(null=True, blank=True)
      participants = models.ManyToManyField(User, related_name='participants', blank=True)
      updated = models.DateTimeField(auto_now=True)
      created = models.DateTimeField(auto_now_add=True)
      slug = models.SlugField(null=True, blank= True)
  
      def save(self, *args, **kwargs):
  
          if self.slug == None:
              slug = slugify(self.name)
              self.slug = slug
          super().save(*args, **kwargs)
      class Meta:
          ordering = ['-updated', '-created']
  
      def __str__(self):
          return self.name
  
  
  class Message(models.Model):
      auther = models.ForeignKey(User, on_delete=models.CASCADE)
      room = models.ForeignKey(Room, on_delete=models.CASCADE)
      body = models.TextField()
      updated = models.DateTimeField(auto_now=True)
      created = models.DateTimeField(auto_now_add=True)
  
      class Meta:
          ordering = ['-updated', '-created']
  
      def __str__(self):
          return self.body[0:50]