Update while working on Django 1.5 upgrade
This commit is contained in:
parent
2479b0a24d
commit
9c989d886b
25 changed files with 1112 additions and 357 deletions
|
@ -5,13 +5,20 @@ from django.contrib.auth.models import User
|
|||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.db.models.signals import post_save
|
||||
|
||||
class Salle (models.Model):
|
||||
name = models.CharField ("Nom", max_length = 300)
|
||||
address = models.TextField ("Adresse")
|
||||
|
||||
def __unicode__ (self):
|
||||
return self.name
|
||||
|
||||
class Spectacle (models.Model):
|
||||
title = models.CharField ("Titre", max_length = 300)
|
||||
date = models.DateTimeField ("Date & heure")
|
||||
location = models.CharField ("Lieu", max_length = 300,
|
||||
blank = True, null = True)
|
||||
location = models.ForeignKey(Salle)
|
||||
description = models.TextField ("Description", blank = True)
|
||||
slots_description = models.TextField ("Description des places", blank = True)
|
||||
#slots_description = models.TextField ("Description des places", blank = True)
|
||||
price = models.FloatField("Prix d'une place", blank = True)
|
||||
slots = models.IntegerField ("Places")
|
||||
priority = models.IntegerField ("Priorité", default = 1000)
|
||||
|
||||
|
@ -22,12 +29,25 @@ class Spectacle (models.Model):
|
|||
def __repr__ (self):
|
||||
return u"[%s]" % self.__unicode__()
|
||||
|
||||
def date_no_seconds(self):
|
||||
return self.date.strftime('%d %b %Y %H:%M')
|
||||
|
||||
def __unicode__ (self):
|
||||
return u"%s - %s @ %s" % (self.title, self.date, self.location)
|
||||
return u"%s - %s @ %s, %.02f€" % (self.title, self.date_no_seconds(), self.location, self.price)
|
||||
|
||||
PAYMENT_TYPES = (
|
||||
("cash",u"Cash"),
|
||||
("cb","CB"),
|
||||
("cheque",u"Chèque"),
|
||||
("autre",u"Autre"),
|
||||
)
|
||||
|
||||
class Participant (models.Model):
|
||||
user = models.ForeignKey(User, unique = True)
|
||||
choices = models.ManyToManyField(Spectacle, through = "ChoixSpectacle")
|
||||
choices = models.ManyToManyField(Spectacle, through = "ChoixSpectacle", related_name = "chosen_by")
|
||||
attributions = models.ManyToManyField(Spectacle, 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)
|
||||
|
||||
def __unicode__ (self):
|
||||
return u"%s" % (self.user)
|
||||
|
@ -40,5 +60,14 @@ class ChoixSpectacle (models.Model):
|
|||
autoquit = models.BooleanField("Abandon<sup>2</sup>")
|
||||
class Meta:
|
||||
ordering = ("priority",)
|
||||
#unique_together = (("participant", "spectacle",),)
|
||||
unique_together = (("participant", "spectacle",),)
|
||||
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):
|
||||
return u"%s -- %s" % (self.participant, self.spectacle)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue