change shotgun en booleanfield
This commit is contained in:
parent
e267cb91ef
commit
4c6b33ccb4
3 changed files with 12 additions and 25 deletions
|
@ -228,7 +228,6 @@ class SpectacleRevente(models.Model):
|
|||
answered_mail = models.ManyToManyField(Participant,
|
||||
related_name="wanted",
|
||||
blank=True)
|
||||
|
||||
seller = models.ForeignKey(Participant,
|
||||
related_name="original_shows",
|
||||
verbose_name="Vendeur")
|
||||
|
@ -239,6 +238,8 @@ class SpectacleRevente(models.Model):
|
|||
default=False)
|
||||
tirage_done = models.BooleanField("Tirage effectué",
|
||||
default=False)
|
||||
shotgun = models.BooleanField("Disponible immédiatement",
|
||||
default=False)
|
||||
|
||||
@property
|
||||
def expiration_time(self):
|
||||
|
@ -255,16 +256,6 @@ class SpectacleRevente(models.Model):
|
|||
.astimezone(timezone.get_current_timezone()) \
|
||||
.strftime('%D à %H:%M')
|
||||
|
||||
@property
|
||||
def shotgun(self):
|
||||
# Soit on a dépassé le délai du tirage, soit il reste peu de
|
||||
# temps avant le spectacle
|
||||
# On se laisse 5min de marge pour cron
|
||||
return (timezone.now() > self.expiration_time + timedelta(minutes=5) or
|
||||
(self.attribution.spectacle.date <= timezone.now() +
|
||||
timedelta(days=1))) and (timezone.now() >= self.date +
|
||||
timedelta(minutes=15))
|
||||
|
||||
def __str__(self):
|
||||
return "%s -- %s" % (self.seller,
|
||||
self.attribution.spectacle.title)
|
||||
|
@ -318,6 +309,7 @@ class SpectacleRevente(models.Model):
|
|||
connection = mail.get_connection()
|
||||
connection.send_messages(mails_to_send)
|
||||
self.notif_sent = True
|
||||
self.shotgun = True
|
||||
self.save()
|
||||
|
||||
def tirage(self):
|
||||
|
@ -350,4 +342,5 @@ Le BdA""" % (spectacle.title, winner.user.get_full_name(), winner.user.email)
|
|||
mail_seller, "bda@ens.fr", [seller.user.email],
|
||||
fail_silently=False)
|
||||
self.tirage_done = True
|
||||
self.shotgun = True
|
||||
self.save()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue