forked from DGNum/gestioCOF
fix affichage admin
This commit is contained in:
parent
f44b3fc33c
commit
6793194adc
2 changed files with 8 additions and 5 deletions
|
@ -214,7 +214,8 @@ class SpectacleReventeAdmin(admin.ModelAdmin):
|
||||||
return obj.attribution.participant
|
return obj.attribution.participant
|
||||||
|
|
||||||
list_display = ("spectacle", "participant", "date", "sold")
|
list_display = ("spectacle", "participant", "date", "sold")
|
||||||
readonly_fields = ("shotgun",)
|
raw_id_fields = ("attribution",)
|
||||||
|
readonly_fields = ("shotgun", "expiration_time")
|
||||||
list_filter = ("sold", )
|
list_filter = ("sold", )
|
||||||
search_fields = ("spectacle__title",
|
search_fields = ("spectacle__title",
|
||||||
"participant__user__username",
|
"participant__user__username",
|
||||||
|
|
|
@ -179,7 +179,8 @@ class Attribution(models.Model):
|
||||||
given = models.BooleanField("Donnée", default=False)
|
given = models.BooleanField("Donnée", default=False)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return "%s -- %s" % (self.participant, self.spectacle)
|
return "%s -- %s, %s" % (self.participant.user, self.spectacle.title,
|
||||||
|
self.spectacle.date)
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
@python_2_unicode_compatible
|
||||||
|
@ -192,13 +193,14 @@ class SpectacleRevente(models.Model):
|
||||||
def get_expiration_time(self):
|
def get_expiration_time(self):
|
||||||
remaining_time = (self.attribution.spectacle.date - self.date)
|
remaining_time = (self.attribution.spectacle.date - self.date)
|
||||||
delay = max(datetime.timedelta(hours=2),
|
delay = max(datetime.timedelta(hours=2),
|
||||||
min(remaining_time/2, datetime.timedelta(days=2)))
|
min(remaining_time//2, datetime.timedelta(days=2)))
|
||||||
return self.date + delay
|
return self.date + delay
|
||||||
expiration_time = property(get_expiration_time)
|
expiration_time = property(get_expiration_time)
|
||||||
|
|
||||||
def get_shotgun(self):
|
def get_shotgun(self):
|
||||||
return timezone.now > self.expiration_time
|
return timezone.now() > self.expiration_time
|
||||||
shotgun = property(get_shotgun)
|
shotgun = property(get_shotgun)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return "%s" % self.attribution
|
return "%s -- %s" % (self.attribution.participant.user,
|
||||||
|
self.attribution.spectacle.title)
|
||||||
|
|
Loading…
Reference in a new issue