from django.db import models from gestion.models import ErnestoUser ANSWERS = ( ('oui', 'Oui'), ('non', 'Non'), ('pe', 'Peut-être'), ) class Event(models.Model): nom = models.CharField(max_length=100) nomcourt = models.CharField(max_length=9, verbose_name="Nom court") date = models.DateField() debut = models.TimeField() fin = models.TimeField(blank=True, null=True) slug = models.CharField(max_length=7, editable=False, unique=True) lieu = models.CharField(max_length=200) description = models.TextField(blank=True) desc_users = models.TextField( blank=True, verbose_name="Infos (visible seulement des fanfaron-ne-s)", null=True) calendrier = models.BooleanField( default=False, verbose_name="Afficher dans le calendrier pour tous") def __str__(self): return self.nom class Meta: verbose_name = "Événement" class Participants(models.Model): event = models.ForeignKey(Event) participant = models.ForeignKey(ErnestoUser) reponse = models.CharField("Réponse", max_length=20, default="non", choices=ANSWERS) details = models.CharField(max_length=50, blank=True) # Create your models here.