ernestophone.ens.fr/calendrier/models.py

41 lines
1.3 KiB
Python
Raw Normal View History

2015-04-13 18:56:43 +02:00
from django.db import models
2015-07-22 22:08:59 +02:00
from gestion.models import ErnestoUser
ANSWERS = (
('oui', 'Oui'),
('non', 'Non'),
('pe', 'Peut-être'),
)
2015-04-13 18:56:43 +02:00
2015-04-13 18:56:43 +02:00
class Event(models.Model):
nom = models.CharField(max_length=100)
2015-09-23 08:08:26 +02:00
nomcourt = models.CharField(max_length=9, verbose_name="Nom court")
2015-04-13 18:56:43 +02:00
date = models.DateField()
debut = models.TimeField()
fin = models.TimeField(blank=True, null=True)
2015-07-22 22:08:59 +02:00
slug = models.CharField(max_length=7, editable=False, unique=True)
2015-04-13 18:56:43 +02:00
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")
2015-04-13 18:56:43 +02:00
def __str__(self):
return self.nom
2015-07-22 22:08:59 +02:00
class Meta:
verbose_name = "Événement"
2015-07-22 22:08:59 +02:00
class Participants(models.Model):
2018-01-04 23:43:10 +01:00
event = models.ForeignKey(Event, on_delete=models.CASCADE)
participant = models.ForeignKey(ErnestoUser, on_delete=models.CASCADE)
reponse = models.CharField("Réponse", max_length=20, default="non",
choices=ANSWERS)
details = models.CharField(max_length=50, blank=True)