ernestophone.ens.fr/calendrier/models.py

35 lines
1.2 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
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)
2015-09-23 08:08:26 +02:00
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"
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)
2015-07-22 22:08:59 +02:00
2015-04-13 18:56:43 +02:00
# Create your models here.