From 49afda933a9c3724501da264a7a6c9ead2b0b609 Mon Sep 17 00:00:00 2001 From: Ludovic Stephan Date: Mon, 25 Jul 2016 02:51:19 +0200 Subject: [PATCH] model changes --- bda/admin.py | 3 +-- bda/models.py | 7 ++++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/bda/admin.py b/bda/admin.py index 05947534..2b24dbb7 100644 --- a/bda/admin.py +++ b/bda/admin.py @@ -213,10 +213,9 @@ class SpectacleReventeAdmin(admin.ModelAdmin): def participant(self, obj): return obj.attribution.participant - list_display = ("spectacle", "participant", "date", "sold") + list_display = ("spectacle", "participant", "date", "soldTo") raw_id_fields = ("attribution",) readonly_fields = ("shotgun", "expiration_time") - list_filter = ("sold", ) search_fields = ("spectacle__title", "participant__user__username", "participant__user__firstname", diff --git a/bda/models.py b/bda/models.py index 1e80b248..77b7d00c 100644 --- a/bda/models.py +++ b/bda/models.py @@ -132,6 +132,8 @@ class Participant(models.Model): max_length=6, choices=PAYMENT_TYPES, blank=True) tirage = models.ForeignKey(Tirage) + choicesrevente = models.ManyToManyField(Spectacle, + related_name="revente") def __str__(self): return "%s - %s" % (self.user, self.tirage.title) @@ -189,7 +191,10 @@ class SpectacleRevente(models.Model): related_name="revente") date = models.DateTimeField("Date de mise en vente", 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): remaining_time = (self.attribution.spectacle.date - self.date)