From 4f03efd50e736dc83c6c7e4844635c71492f73f4 Mon Sep 17 00:00:00 2001 From: Yoan Le Clanche Date: Wed, 26 Sep 2018 17:48:06 +0200 Subject: [PATCH] change appointment link condition --- teleforma/views/core.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/teleforma/views/core.py b/teleforma/views/core.py index f74b9700..17882575 100644 --- a/teleforma/views/core.py +++ b/teleforma/views/core.py @@ -332,7 +332,12 @@ class CourseListView(CourseAccessMixin, ListView): context['list_view'] = True context['courses'] = sorted(context['all_courses'], key=lambda k: k['date'], reverse=True)[:1] is_student = self.request.user.student.all().count() - context['hasAppointment'] = AppointmentPeriod.objects.filter(period=context['period']).count() and is_student + appointments = AppointmentPeriod.objects.filter(period=context['period']) + appointments_open = False + for appointment in appointments: + if appointment.is_open: + appointments_open = True + context['hasAppointment'] = appointments_open and is_student home = Home.objects.all() if home: -- 2.39.5