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) 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) calendrier = models.BooleanField(default=False, verbose_name="Afficher dans le calendrier") 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) # Create your models here.