forked from DGNum/gestioCOF
annulations reventes
This commit is contained in:
parent
2aaf9f681e
commit
8f7b036fbc
3 changed files with 18 additions and 9 deletions
|
@ -185,7 +185,8 @@ class Attribution(models.Model):
|
|||
|
||||
@python_2_unicode_compatible
|
||||
class SpectacleRevente(models.Model):
|
||||
attribution = models.OneToOneField(Attribution)
|
||||
attribution = models.OneToOneField(Attribution,
|
||||
related_name="revente")
|
||||
date = models.DateTimeField("Date de mise en vente",
|
||||
default=timezone.now)
|
||||
sold = models.BooleanField("Vendue", default=False)
|
||||
|
@ -194,13 +195,17 @@ class SpectacleRevente(models.Model):
|
|||
remaining_time = (self.attribution.spectacle.date - self.date)
|
||||
delay = max(datetime.timedelta(hours=2),
|
||||
min(remaining_time//2, datetime.timedelta(days=2)))
|
||||
return self.date + delay
|
||||
return self.date + delay + datetime.timedelta(hours=1)
|
||||
expiration_time = property(get_expiration_time)
|
||||
|
||||
def get_shotgun(self):
|
||||
return timezone.now() > self.expiration_time
|
||||
shotgun = property(get_shotgun)
|
||||
|
||||
def get_cancellable(self):
|
||||
return timezone.now() < self.date + datetime.timedelta(hours=1)
|
||||
cancellable = property(get_cancellable)
|
||||
|
||||
def __str__(self):
|
||||
return "%s -- %s" % (self.attribution.participant.user,
|
||||
self.attribution.spectacle.title)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue