From 77511d8acdd21c4cb4d20f6fd32d4a27a15a3568 Mon Sep 17 00:00:00 2001 From: Ludovic Stephan Date: Tue, 27 Sep 2016 15:44:27 +0200 Subject: [PATCH] more coherent names --- bda/models.py | 14 +++++++------- bda/views.py | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/bda/models.py b/bda/models.py index c3b28d5b..1074e58b 100644 --- a/bda/models.py +++ b/bda/models.py @@ -161,7 +161,7 @@ class Participant(models.Model): blank=True) tirage = models.ForeignKey(Tirage) choicesrevente = models.ManyToManyField(Spectacle, - related_name="revente", + related_name="subscribed", blank=True) def __str__(self): @@ -220,9 +220,9 @@ class SpectacleRevente(models.Model): related_name="revente") date = models.DateTimeField("Date de mise en vente", default=timezone.now) - interested = models.ManyToManyField(Participant, - related_name="wanted", - blank=True) + answered_mail = models.ManyToManyField(Participant, + related_name="wanted", + blank=True) seller = models.ForeignKey(Participant, related_name="original_shows", verbose_name="Vendeur") @@ -262,7 +262,7 @@ class SpectacleRevente(models.Model): verbose_name = "Revente" def send_notif(self): - inscrits = self.attribution.spectacle.revente.select_related('user') + inscrits = self.attribution.spectacle.subscribed.select_related('user') mails_to_send = [] mail_object = "%s" % (self.attribution.spectacle) @@ -283,7 +283,7 @@ class SpectacleRevente(models.Model): self.save() def mail_shotgun(self): - inscrits = self.attribution.spectacle.revente.select_related('user') + inscrits = self.attribution.spectacle.subscribed.select_related('user') mails_to_send = [] mail_object = "%s" % (self.attribution.spectacle) @@ -304,7 +304,7 @@ class SpectacleRevente(models.Model): self.save() def tirage(self): - inscrits = self.interested + inscrits = self.answered_mail spectacle = self.attribution.spectacle seller = self.seller if inscrits.exists(): diff --git a/bda/views.py b/bda/views.py index 79212710..e9a000cb 100644 --- a/bda/views.py +++ b/bda/views.py @@ -333,7 +333,7 @@ def revente(request, tirage_id): revente = rev.get() revente.date = timezone.now() - timedelta(hours=1) revente.soldTo = None - revente.interested = None + revente.answered_mail = None else: resellform = ResellForm(participant, prefix='resell') @@ -367,7 +367,7 @@ def revente_interested(request, revente_id): if timezone.now() < revente.date + timedelta(hours=1) or revente.shotgun: return render(request, "bda-wrongtime.html", {}) - revente.interested.add(participant) + revente.answered_mail.add(participant) return render(request, "bda-interested.html", {"spectacle": revente.attribution.spectacle, "date": revente.expiration_time}) @@ -409,7 +409,7 @@ def list_revente(request, tirage_id): if revente.shotgun and not revente.soldTo: deja_revente = True else: - revente.interested.add(participant) + revente.answered_mail.add(participant) break else: form = InscriptionReventeForm(