2020-09-10 15:06:53 +02:00
|
|
|
import uuid
|
2021-04-29 00:27:33 +02:00
|
|
|
|
|
|
|
from django.db import models
|
2020-09-10 15:06:53 +02:00
|
|
|
from django.utils.translation import gettext_lazy as _
|
2021-04-29 00:27:33 +02:00
|
|
|
|
2021-09-30 08:38:47 +02:00
|
|
|
from gestion.models import INSTRU_CHOICES
|
2021-04-29 00:27:33 +02:00
|
|
|
from gestion.models import ErnestoUser
|
2015-07-22 22:08:59 +02:00
|
|
|
|
|
|
|
ANSWERS = (
|
2021-04-29 00:27:33 +02:00
|
|
|
("oui", _("Oui")),
|
|
|
|
("non", _("Non")),
|
|
|
|
("pe", _("Peut-etre")),
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2015-04-13 18:56:43 +02:00
|
|
|
class Event(models.Model):
|
2021-04-29 00:27:33 +02:00
|
|
|
|
2015-04-13 18:56:43 +02:00
|
|
|
nom = models.CharField(max_length=100)
|
2020-09-10 15:06:53 +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)
|
2021-04-29 00:27:33 +02:00
|
|
|
slug = models.CharField(
|
|
|
|
max_length=7, editable=False, unique=True, default=uuid.uuid1
|
|
|
|
)
|
2015-04-13 18:56:43 +02:00
|
|
|
lieu = models.CharField(max_length=200)
|
|
|
|
description = models.TextField(blank=True)
|
2020-09-10 15:06:53 +02:00
|
|
|
description_en = models.TextField(blank=True)
|
2016-07-14 01:58:52 +02:00
|
|
|
desc_users = models.TextField(
|
2021-04-29 00:27:33 +02:00
|
|
|
blank=True,
|
2021-08-09 12:41:44 +02:00
|
|
|
verbose_name=_("Infos (visible seulement des fanfaron·ne·s)"),
|
2021-04-29 00:27:33 +02:00
|
|
|
null=True,
|
|
|
|
)
|
2020-09-10 15:06:53 +02:00
|
|
|
desc_users_en = models.TextField(
|
2021-04-29 00:27:33 +02:00
|
|
|
blank=True,
|
2021-08-09 12:41:44 +02:00
|
|
|
verbose_name=_("Infos en anglais (visible seulement des fanfaron·ne·s"),
|
2021-04-29 00:27:33 +02:00
|
|
|
null=True,
|
|
|
|
)
|
2020-09-10 15:06:53 +02:00
|
|
|
CALENDRIER_CHOICES = [
|
2021-04-29 00:27:33 +02:00
|
|
|
("F", _("Visible seulement par les fanfarons")),
|
|
|
|
("T", _("Afficher dans le calendrier pour tous")),
|
|
|
|
("H", _("Hall of fame")),
|
2021-08-09 12:41:44 +02:00
|
|
|
("C", _("Visible seulement par les cheff·e·s")),
|
|
|
|
("D", _("Visible seulement par les cheff·e·s et sur l'agenda public")),
|
2020-09-10 15:06:53 +02:00
|
|
|
]
|
|
|
|
calendrier = models.CharField(
|
|
|
|
max_length=1,
|
|
|
|
choices=CALENDRIER_CHOICES,
|
2021-04-29 00:27:33 +02:00
|
|
|
default="F",
|
2020-09-10 15:06:53 +02:00
|
|
|
)
|
|
|
|
|
2015-04-13 18:56:43 +02:00
|
|
|
def __str__(self):
|
|
|
|
return self.nom
|
2015-07-22 22:08:59 +02:00
|
|
|
|
|
|
|
class Meta:
|
2020-09-10 15:06:53 +02:00
|
|
|
verbose_name = _("Evenement")
|
2016-07-14 01:58:52 +02:00
|
|
|
|
2021-04-29 00:27:33 +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)
|
2021-04-29 00:27:33 +02:00
|
|
|
reponse = models.CharField(
|
|
|
|
_("Réponse"), max_length=20, default="non", choices=ANSWERS
|
|
|
|
)
|
2021-09-30 08:38:47 +02:00
|
|
|
instrument = models.CharField(max_length=50, blank=True, null=True, choices=INSTRU_CHOICES)
|
|
|
|
instrument_autre = models.CharField(max_length=50, blank=True, null=True)
|
2021-06-07 00:56:03 +02:00
|
|
|
dont_play_main = models.CharField(
|
|
|
|
_("Je veux jouer d'un instrument different de mon instrument principal:"),
|
|
|
|
default="Non",
|
|
|
|
null=False,
|
|
|
|
max_length=3,
|
|
|
|
choices=[("Non", _("Non")), ("Oui", _("Oui"))],
|
|
|
|
)
|
2016-06-21 00:33:32 +02:00
|
|
|
details = models.CharField(max_length=50, blank=True)
|