Add last courses block to school schedules template

remotes/origin/hasaccess
Ivlev Denis 8 years ago
parent 70b9b748e2
commit 0abe6f7058
  1. 21
      apps/school/templates/blocks/last_courses.html
  2. 1
      apps/school/templates/blocks/schedule_purchased.html
  3. 6
      apps/school/views.py

@ -0,0 +1,21 @@
{% load static %} {% if course_items %}
<div class="section section_courses">
<div class="section__center center">
<div class="text">
<p>Хотите ещё? :)
<br>Для Вас у нас есть дополнительные видео-курсы на самые душещипательные темы.</p>
</div>
<div class="head">
<div class="head__title title title_center">Видео-курсы</div>
</div>
<div class="courses">
<div class="courses__list">
{% include "course/course_items.html" %}
</div>
<div class="courses__load load">
<a class="load__btn btn" href="{% url 'courses' %}">Узнать подробнее</a>
</div>
</div>
</div>
</div>
{% endif %}

@ -122,4 +122,5 @@
</div> </div>
</div> </div>
</div> </div>
{% include './last_courses.html' %}
</div> </div>

@ -7,6 +7,7 @@ from django.utils.decorators import method_decorator
from django.utils.timezone import now from django.utils.timezone import now
from django.views.generic import ListView, UpdateView, TemplateView, DetailView from django.views.generic import ListView, UpdateView, TemplateView, DetailView
from apps.course.models import Course
from apps.payment.models import SchoolPayment from apps.payment.models import SchoolPayment
from .models import LiveLesson, SchoolSchedule from .models import LiveLesson, SchoolSchedule
@ -79,9 +80,10 @@ class SchoolView(TemplateView):
school_payment = SchoolPayment.objects.filter(date_start__lte=date_now, date_end__gte=date_now) school_payment = SchoolPayment.objects.filter(date_start__lte=date_now, date_end__gte=date_now)
school_payment_exists = school_payment.exists() school_payment_exists = school_payment.exists()
context.update({ context.update({
'subscription_ends': school_payment.first().date_end if school_payment_exists else None, 'course_items': Course.objects.filter(status=Course.PUBLISHED)[:6],
'is_purchased': school_payment_exists, 'is_purchased': school_payment_exists,
'school_schedules': SchoolSchedule.objects.all(),
'min_school_price': SchoolSchedule.objects.aggregate(Min('month_price'))['month_price__min'], 'min_school_price': SchoolSchedule.objects.aggregate(Min('month_price'))['month_price__min'],
'school_schedules': SchoolSchedule.objects.all(),
'subscription_ends': school_payment.first().date_end if school_payment_exists else None,
}) })
return context return context

Loading…
Cancel
Save