model changes

This commit is contained in:
Ludovic Stephan 2016-07-25 02:51:19 +02:00
parent 8f7b036fbc
commit 49afda933a
2 changed files with 7 additions and 3 deletions

View file

@ -213,10 +213,9 @@ class SpectacleReventeAdmin(admin.ModelAdmin):
def participant(self, obj): def participant(self, obj):
return obj.attribution.participant return obj.attribution.participant
list_display = ("spectacle", "participant", "date", "sold") list_display = ("spectacle", "participant", "date", "soldTo")
raw_id_fields = ("attribution",) raw_id_fields = ("attribution",)
readonly_fields = ("shotgun", "expiration_time") readonly_fields = ("shotgun", "expiration_time")
list_filter = ("sold", )
search_fields = ("spectacle__title", search_fields = ("spectacle__title",
"participant__user__username", "participant__user__username",
"participant__user__firstname", "participant__user__firstname",

View file

@ -132,6 +132,8 @@ class Participant(models.Model):
max_length=6, choices=PAYMENT_TYPES, max_length=6, choices=PAYMENT_TYPES,
blank=True) blank=True)
tirage = models.ForeignKey(Tirage) tirage = models.ForeignKey(Tirage)
choicesrevente = models.ManyToManyField(Spectacle,
related_name="revente")
def __str__(self): def __str__(self):
return "%s - %s" % (self.user, self.tirage.title) return "%s - %s" % (self.user, self.tirage.title)
@ -189,7 +191,10 @@ class SpectacleRevente(models.Model):
related_name="revente") related_name="revente")
date = models.DateTimeField("Date de mise en vente", date = models.DateTimeField("Date de mise en vente",
default=timezone.now) default=timezone.now)
sold = models.BooleanField("Vendue", default=False) interested = models.ManyToManyField(Participant,
related_name="wanted",
blank=True, null=True)
soldTo = models.ForeignKey(Participant, blank=True, null=True)
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)