Major update
This commit is contained in:
parent
8e1bf7b705
commit
2479b0a24d
33 changed files with 1194 additions and 110 deletions
44
bda/models.py
Normal file
44
bda/models.py
Normal file
|
@ -0,0 +1,44 @@
|
|||
# coding: utf-8
|
||||
|
||||
from django.db import models
|
||||
from django.contrib.auth.models import User
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.db.models.signals import post_save
|
||||
|
||||
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)
|
||||
description = models.TextField ("Description", blank = True)
|
||||
slots_description = models.TextField ("Description des places", blank = True)
|
||||
slots = models.IntegerField ("Places")
|
||||
priority = models.IntegerField ("Priorité", default = 1000)
|
||||
|
||||
class Meta:
|
||||
verbose_name = "Spectacle"
|
||||
ordering = ("priority", "date","title",)
|
||||
|
||||
def __repr__ (self):
|
||||
return u"[%s]" % self.__unicode__()
|
||||
|
||||
def __unicode__ (self):
|
||||
return u"%s - %s @ %s" % (self.title, self.date, self.location)
|
||||
|
||||
class Participant (models.Model):
|
||||
user = models.ForeignKey(User, unique = True)
|
||||
choices = models.ManyToManyField(Spectacle, through = "ChoixSpectacle")
|
||||
|
||||
def __unicode__ (self):
|
||||
return u"%s" % (self.user)
|
||||
|
||||
class ChoixSpectacle (models.Model):
|
||||
participant = models.ForeignKey(Participant)
|
||||
spectacle = models.ForeignKey(Spectacle, related_name = "participants")
|
||||
priority = models.PositiveIntegerField("Priorité")
|
||||
double = models.BooleanField("Deux places<sup>1</sup>")
|
||||
autoquit = models.BooleanField("Abandon<sup>2</sup>")
|
||||
class Meta:
|
||||
ordering = ("priority",)
|
||||
#unique_together = (("participant", "spectacle",),)
|
||||
verbose_name = "voeu"
|
Loading…
Add table
Add a link
Reference in a new issue