From 7e07387301a727f1747b217fedf9f5d7177a5522 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Wed, 1 Jul 2020 20:48:23 +0200 Subject: [PATCH] manager: only display events as full when main list is full (#44657) --- chrono/agendas/models.py | 5 +++++ .../templates/chrono/manager_events_agenda_month_view.html | 4 ++-- tests/test_manager.py | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/chrono/agendas/models.py b/chrono/agendas/models.py index 803a666d..4c8d5824 100644 --- a/chrono/agendas/models.py +++ b/chrono/agendas/models.py @@ -35,6 +35,7 @@ from django.core.validators import MaxValueValidator from django.db import models, transaction from django.db.models import Count, Q, Case, When from django.urls import reverse +from django.utils import functional from django.utils.dates import WEEKDAYS from django.utils.encoding import force_text from django.utils.formats import date_format @@ -776,6 +777,10 @@ class Event(models.Model): # label can be empty return slugify(self.label or ('%s-event' % self.agenda.label)) + @functional.cached_property + def main_list_full(self): + return bool(self.booked_places >= self.places) + def check_full(self): self.full = bool( (self.booked_places >= self.places and self.waiting_list_places == 0) diff --git a/chrono/manager/templates/chrono/manager_events_agenda_month_view.html b/chrono/manager/templates/chrono/manager_events_agenda_month_view.html index 5be3728c..a063ebce 100644 --- a/chrono/manager/templates/chrono/manager_events_agenda_month_view.html +++ b/chrono/manager/templates/chrono/manager_events_agenda_month_view.html @@ -9,7 +9,7 @@