Merge branch 'master' into Kerl/fix_32_do_tirage
This commit is contained in:
commit
3aa9667eb9
28 changed files with 1010 additions and 605 deletions
|
@ -6,6 +6,7 @@ from django.db import models
|
|||
from django.contrib.auth.models import User
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
|
||||
class Tirage(models.Model):
|
||||
title = models.CharField("Titre", max_length=300)
|
||||
ouverture = models.DateTimeField("Date et heure d'ouverture du tirage")
|
||||
|
@ -20,14 +21,16 @@ class Tirage(models.Model):
|
|||
|
||||
def __unicode__(self):
|
||||
return u"%s - %s" % (self.title, self.date_no_seconds())
|
||||
|
||||
|
||||
|
||||
class Salle(models.Model):
|
||||
name = models.CharField("Nom", max_length = 300)
|
||||
name = models.CharField("Nom", max_length=300)
|
||||
address = models.TextField("Adresse")
|
||||
|
||||
def __unicode__ (self):
|
||||
def __unicode__(self):
|
||||
return self.name
|
||||
|
||||
|
||||
class Spectacle(models.Model):
|
||||
title = models.CharField("Titre", max_length=300)
|
||||
date = models.DateTimeField("Date & heure")
|
||||
|
@ -41,9 +44,9 @@ class Spectacle(models.Model):
|
|||
|
||||
class Meta:
|
||||
verbose_name = "Spectacle"
|
||||
ordering = ("priority", "date","title",)
|
||||
ordering = ("priority", "date", "title",)
|
||||
|
||||
def __repr__ (self):
|
||||
def __repr__(self):
|
||||
return u"[%s]" % self.__unicode__()
|
||||
|
||||
def timestamp(self):
|
||||
|
@ -52,31 +55,33 @@ class Spectacle(models.Model):
|
|||
def date_no_seconds(self):
|
||||
return self.date.strftime('%d %b %Y %H:%M')
|
||||
|
||||
def __unicode__ (self):
|
||||
def __unicode__(self):
|
||||
return u"%s - %s, %s, %.02f€" % (self.title, self.date_no_seconds(),
|
||||
self.location, self.price)
|
||||
self.location, self.price)
|
||||
|
||||
PAYMENT_TYPES = (
|
||||
("cash",u"Cash"),
|
||||
("cb","CB"),
|
||||
("cheque",u"Chèque"),
|
||||
("autre",u"Autre"),
|
||||
("cash", u"Cash"),
|
||||
("cb", "CB"),
|
||||
("cheque", u"Chèque"),
|
||||
("autre", u"Autre"),
|
||||
)
|
||||
|
||||
|
||||
class Participant(models.Model):
|
||||
user = models.ForeignKey(User)
|
||||
choices = models.ManyToManyField(Spectacle,
|
||||
through="ChoixSpectacle",
|
||||
related_name="chosen_by")
|
||||
through="ChoixSpectacle",
|
||||
related_name="chosen_by")
|
||||
attributions = models.ManyToManyField(Spectacle,
|
||||
through="Attribution",
|
||||
related_name="attributed_to")
|
||||
paid = models.BooleanField (u"A payé", default=False)
|
||||
through="Attribution",
|
||||
related_name="attributed_to")
|
||||
paid = models.BooleanField(u"A payé", default=False)
|
||||
paymenttype = models.CharField(u"Moyen de paiement",
|
||||
max_length=6, choices=PAYMENT_TYPES, blank=True)
|
||||
max_length=6, choices=PAYMENT_TYPES,
|
||||
blank=True)
|
||||
tirage = models.ForeignKey(Tirage)
|
||||
|
||||
def __unicode__ (self):
|
||||
|
||||
def __unicode__(self):
|
||||
return u"%s" % (self.user)
|
||||
|
||||
DOUBLE_CHOICES = (
|
||||
|
@ -85,12 +90,14 @@ DOUBLE_CHOICES = (
|
|||
("double", "2 places sinon rien"),
|
||||
)
|
||||
|
||||
|
||||
class ChoixSpectacle(models.Model):
|
||||
participant = models.ForeignKey(Participant)
|
||||
spectacle = models.ForeignKey(Spectacle, related_name="participants")
|
||||
priority = models.PositiveIntegerField("Priorité")
|
||||
double_choice = models.CharField("Nombre de places",
|
||||
default="1", choices=DOUBLE_CHOICES, max_length=10)
|
||||
default="1", choices=DOUBLE_CHOICES,
|
||||
max_length=10)
|
||||
|
||||
def get_double(self):
|
||||
return self.double_choice != "1"
|
||||
|
@ -106,11 +113,11 @@ class ChoixSpectacle(models.Model):
|
|||
verbose_name = "voeu"
|
||||
verbose_name_plural = "voeux"
|
||||
|
||||
|
||||
class Attribution(models.Model):
|
||||
participant = models.ForeignKey(Participant)
|
||||
spectacle = models.ForeignKey(Spectacle, related_name="attribues")
|
||||
given = models.BooleanField(u"Donnée", default=False)
|
||||
|
||||
def __unicode__ (self):
|
||||
def __unicode__(self):
|
||||
return u"%s -- %s" % (self.participant, self.spectacle)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue