From 436cb3ad86b9334d7ee677581b17eed449c750d3 Mon Sep 17 00:00:00 2001 From: Ivlev Denis Date: Thu, 10 May 2018 18:29:48 +0300 Subject: [PATCH] Update school in user profile --- apps/school/templates/blocks/schedule_purchased.html | 2 ++ apps/user/templates/user/profile.html | 12 ++++-------- apps/user/views.py | 5 ++++- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/apps/school/templates/blocks/schedule_purchased.html b/apps/school/templates/blocks/schedule_purchased.html index e70ca248..03e98e92 100644 --- a/apps/school/templates/blocks/schedule_purchased.html +++ b/apps/school/templates/blocks/schedule_purchased.html @@ -19,6 +19,7 @@
+ {% if not profile %}
{% if is_previous %}
Запись уроков
@@ -32,6 +33,7 @@
+ {% endif %}
{% if is_previous and not live_lessons_exists %} diff --git a/apps/user/templates/user/profile.html b/apps/user/templates/user/profile.html index c1bb7f81..3f5203b6 100644 --- a/apps/user/templates/user/profile.html +++ b/apps/user/templates/user/profile.html @@ -63,6 +63,7 @@
+ @@ -71,9 +72,11 @@ КУРСЫ {% endif %} -
+
+ {% include "blocks/schedule_purchased.html" %} +
@@ -90,13 +93,6 @@
{% endif %} -
-
-
- {% include "course/school.html" %} -
-
-
diff --git a/apps/user/views.py b/apps/user/views.py index a771152e..e98ee454 100644 --- a/apps/user/views.py +++ b/apps/user/views.py @@ -77,9 +77,12 @@ class UserView(DetailView): school_schedules_purchased = school_payment.annotate( joined_weekdays=Func(F('weekdays'), function='unnest',) ).values_list('joined_weekdays', flat=True).distinct() + context['school_schedules_purchased'] = school_schedules_purchased context['school_payment'] = school_payment + context['is_purchased'] = school_payment.exists() + context['profile'] = True if school_payment.exists() and school_payment.last().date_end: - context['school_days_left'] = (school_payment.last().date_end - now().date()).days + context['subscription_ends'] = school_payment.last().date_end context['school_schedules'] = SchoolSchedule.objects.filter( weekday__in=school_schedules_purchased if school_payment.exists() else [], )