From 9776a18e4c923f99df7db64c20bf331884dbfee4 Mon Sep 17 00:00:00 2001 From: Ludovic Stephan Date: Sat, 8 Jun 2019 14:48:18 +0200 Subject: [PATCH] =?UTF-8?q?D=C3=A9place=20les=20champs=20`paid`=20et=20`pa?= =?UTF-8?q?ymenttype`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bda/models.py | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/bda/models.py b/bda/models.py index 9ac38a41..05c2448a 100644 --- a/bda/models.py +++ b/bda/models.py @@ -151,6 +151,25 @@ PAYMENT_TYPES = ( ) +class Attribution(models.Model): + participant = models.ForeignKey("Participant", on_delete=models.CASCADE) + spectacle = models.ForeignKey( + Spectacle, on_delete=models.CASCADE, related_name="attribues" + ) + given = models.BooleanField("Donnée", default=False) + paid = models.BooleanField("Payée", default=False) + paymenttype = models.CharField( + "Moyen de paiement", max_length=6, choices=PAYMENT_TYPES, blank=True + ) + + def __str__(self): + return "%s -- %s, %s" % ( + self.participant.user, + self.spectacle.title, + self.spectacle.date, + ) + + class Participant(models.Model): user = models.ForeignKey(User, on_delete=models.CASCADE) choices = models.ManyToManyField( @@ -159,10 +178,6 @@ class Participant(models.Model): attributions = models.ManyToManyField( Spectacle, through="Attribution", related_name="attributed_to" ) - paid = models.BooleanField("A payé", default=False) - paymenttype = models.CharField( - "Moyen de paiement", max_length=6, choices=PAYMENT_TYPES, blank=True - ) tirage = models.ForeignKey(Tirage, on_delete=models.CASCADE) choicesrevente = models.ManyToManyField( Spectacle, related_name="subscribed", blank=True @@ -212,21 +227,6 @@ class ChoixSpectacle(models.Model): verbose_name_plural = "voeux" -class Attribution(models.Model): - participant = models.ForeignKey(Participant, on_delete=models.CASCADE) - spectacle = models.ForeignKey( - Spectacle, on_delete=models.CASCADE, related_name="attribues" - ) - given = models.BooleanField("Donnée", default=False) - - def __str__(self): - return "%s -- %s, %s" % ( - self.participant.user, - self.spectacle.title, - self.spectacle.date, - ) - - class SpectacleRevente(models.Model): attribution = models.OneToOneField( Attribution, on_delete=models.CASCADE, related_name="revente"