from django.db import models from django.conf import settings from django.utils import timezone import uuid # Create your models here. class comm_opMessage(models.Model): uuid = models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True) sKey = models.CharField("Clé d'identification", max_length=100) sTitle = models.CharField('Titre', max_length=250) sDesc = models.TextField('Description') dtStart = models.DateField("Date de début", default=timezone.now) dtEnd = models.DateField("Date de fin", blank=True, null=True) bDone = models.BooleanField("Effectuée", default=False) sAuthor = models.CharField("Auteur", max_length=120) Author = models.ForeignKey(settings.AUTH_USER_MODEL, verbose_name="Auteur", on_delete=models.DO_NOTHING) dtUpdated = models.DateTimeField('date updated', auto_now=True) dtCreated = models.DateTimeField('date published', auto_now_add=True) def __str__(self): return self.sKey + " -- " + self.sTitle class Meta: verbose_name = "Communication importante" verbose_name_plural = "Communications importantes"