From a63269a4ce177a2a577644d21b197033597f5987 Mon Sep 17 00:00:00 2001 From: Ludovic Stephan Date: Mon, 14 Nov 2016 12:52:02 -0200 Subject: [PATCH] more coherent names --- bda/admin.py | 2 +- bda/management/commands/manage_reventes.py | 2 +- bda/models.py | 7 ++++--- bda/templates/mail-revente-new.txt | 2 +- bda/views.py | 2 +- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/bda/admin.py b/bda/admin.py index 163e50a0..e9bc29f2 100644 --- a/bda/admin.py +++ b/bda/admin.py @@ -225,7 +225,7 @@ class SpectacleReventeAdmin(admin.ModelAdmin): list_display = ("spectacle", "seller", "date", "soldTo") raw_id_fields = ("attribution",) - readonly_fields = ("expiration_time",) + readonly_fields = ("date_tirage",) search_fields = ['attribution__spectacle__title', 'seller__user__username', 'seller__user__first_name', diff --git a/bda/management/commands/manage_reventes.py b/bda/management/commands/manage_reventes.py index 45b9c91a..271b952e 100644 --- a/bda/management/commands/manage_reventes.py +++ b/bda/management/commands/manage_reventes.py @@ -31,7 +31,7 @@ class Command(BaseCommand): revente.send_notif() self.stdout.write("Mail d'inscription à une revente envoyé") # Check si tirage à faire - elif (now >= revente.expiration_time and + elif (now >= revente.date_tirage and not revente.tirage_done): self.stdout.write(str(now)) revente.tirage() diff --git a/bda/models.py b/bda/models.py index 9d7c0303..a44a3d65 100644 --- a/bda/models.py +++ b/bda/models.py @@ -242,7 +242,8 @@ class SpectacleRevente(models.Model): default=False) @property - def expiration_time(self): + def date_tirage(self): + """Renvoie la date du tirage au sort de la revente.""" # L'acheteur doit être connu au plus 12h avant le spectacle remaining_time = (self.attribution.spectacle.date - self.date - timedelta(hours=13)) @@ -251,8 +252,8 @@ class SpectacleRevente(models.Model): # Le vendeur a aussi 1h pour changer d'avis return self.date + delay + timedelta(hours=1) - def expiration_time_str(self): - return self.expiration_time \ + def date_tirage_str(self): + return self.date_tirage \ .astimezone(timezone.get_current_timezone()) \ .strftime('%d/%m/%y à %H:%M') diff --git a/bda/templates/mail-revente-new.txt b/bda/templates/mail-revente-new.txt index ffba3083..b4815e84 100644 --- a/bda/templates/mail-revente-new.txt +++ b/bda/templates/mail-revente-new.txt @@ -2,7 +2,7 @@ Bonjour {{ vendeur.first_name }}, Tu t’es bien inscrit-e pour la revente de {{ spectacle.title }}. -{% with revente.expiration_time as time %} +{% with revente.date_tirage as time %} Le tirage au sort entre tout-e-s les racheteuse-eur-s potentiel-le-s aura lieu le {{ time|date:"DATE_FORMAT" }} à {{ time|time:"TIME_FORMAT" }} (dans {{time|timeuntil }}). Si personne ne s’est inscrit pour racheter la place, celle-ci apparaitra parmi diff --git a/bda/views.py b/bda/views.py index 12c380db..da74c6aa 100644 --- a/bda/views.py +++ b/bda/views.py @@ -376,7 +376,7 @@ def revente_interested(request, revente_id): revente.answered_mail.add(participant) return render(request, "bda-interested.html", {"spectacle": revente.attribution.spectacle, - "date": revente.expiration_time}) + "date": revente.date_tirage}) @login_required