|
|
|
|
@ -27,6 +27,8 @@ class IndexView(TemplateView): |
|
|
|
|
school_schedule = SchoolSchedule.objects.get(weekday=now_time.isoweekday()) |
|
|
|
|
except SchoolSchedule.DoesNotExist: |
|
|
|
|
online = False |
|
|
|
|
online_coming_soon = False |
|
|
|
|
school_schedule = None |
|
|
|
|
else: |
|
|
|
|
end_at = datetime.combine(now_time.today(), school_schedule.start_at) |
|
|
|
|
online = ( |
|
|
|
|
@ -34,6 +36,12 @@ class IndexView(TemplateView): |
|
|
|
|
(end_at + timedelta(hours=2)).time() >= now_time.time() and |
|
|
|
|
school_schedule.current_live_lesson() |
|
|
|
|
) |
|
|
|
|
online_coming_soon = ( |
|
|
|
|
school_schedule.start_at < now_time.time() and |
|
|
|
|
(school_schedule.start_at - timedelta(hours=5)).time() >= now_time.time() and |
|
|
|
|
school_schedule.current_live_lesson() |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
date_now = now_time.date() |
|
|
|
|
if self.request.user.is_authenticated: |
|
|
|
|
school_payment = SchoolPayment.objects.filter( |
|
|
|
|
@ -62,6 +70,7 @@ class IndexView(TemplateView): |
|
|
|
|
|
|
|
|
|
context.update({ |
|
|
|
|
'online': online, |
|
|
|
|
'online_coming_soon': online_coming_soon, |
|
|
|
|
'course_items': Course.objects.filter(status=Course.PUBLISHED)[:6], |
|
|
|
|
'is_purchased': school_payment_exists, |
|
|
|
|
'min_school_price': SchoolSchedule.objects.aggregate(Min('month_price'))['month_price__min'], |
|
|
|
|
|