|
|
|
|
@ -1,6 +1,6 @@ |
|
|
|
|
from django.contrib.auth import get_user_model |
|
|
|
|
from django.contrib.auth.decorators import login_required, user_passes_test |
|
|
|
|
from django.db.models import Min |
|
|
|
|
from django.db.models import Min, F |
|
|
|
|
from django.http import Http404 |
|
|
|
|
from django.shortcuts import get_object_or_404 |
|
|
|
|
from django.utils.decorators import method_decorator |
|
|
|
|
@ -95,7 +95,9 @@ class SchoolView(TemplateView): |
|
|
|
|
'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'], |
|
|
|
|
'school_schedules': SchoolSchedule.objects.all(), |
|
|
|
|
'school_schedules': SchoolSchedule.objects.annotate( |
|
|
|
|
width=date_now.weekday()-F('weekday') % 7, |
|
|
|
|
).order_by('-width'), |
|
|
|
|
'school_schedules_purchased': school_schedules_purchased, |
|
|
|
|
'subscription_ends': school_payment.first().date_end if school_payment_exists else None, |
|
|
|
|
}) |
|
|
|
|
|