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
|
|
|
|
2016-07-14 01:58:52 +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)
|
2016-07-14 01:58:52 +02:00
|
|
|
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"
|
|
|
|
|
2016-07-14 01:58:52 +02:00
|
|
|
|
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)
|
2016-07-14 01:58:52 +02:00
|
|
|
reponse = models.CharField("Réponse", max_length=20, default="non",
|
|
|
|
choices=ANSWERS)
|
2016-06-21 00:33:32 +02:00
|
|
|
details = models.CharField(max_length=50, blank=True)
|