From cb809cb8fa154831359c72e80251f64ea97ddbd6 Mon Sep 17 00:00:00 2001 From: gzbender Date: Thu, 19 Jul 2018 14:55:42 +0500 Subject: [PATCH 01/23] =?UTF-8?q?LIL-560=20=D0=9A=D0=BD=D0=BE=D0=BF=D0=BA?= =?UTF-8?q?=D1=83=20=C2=AB=D0=A1=D0=BC=D0=BE=D1=82=D1=80=D0=B5=D1=82=D1=8C?= =?UTF-8?q?=20=D1=83=D1=80=D0=BE=D0=BA=C2=BB=20=D0=BF=D0=BE=D0=B4=D0=BD?= =?UTF-8?q?=D1=8F=D1=82=D1=8C=20=D0=B2=D1=8B=D1=88=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../blocks/_schedule_purchased_item.html | 78 ------------------- apps/school/templates/blocks/schedule.html | 69 +--------------- .../schedule_item.html} | 38 +++++---- .../templates/blocks/schedule_purchased.html | 4 +- .../templates/school/schedules_print.html | 62 +-------------- .../templates/summer/schedule_purchased.html | 4 +- web/src/sass/_common.sass | 11 ++- 7 files changed, 41 insertions(+), 225 deletions(-) delete mode 100644 apps/school/templates/blocks/_schedule_purchased_item.html rename apps/school/templates/{summer/_schedule_purchased_item.html => blocks/schedule_item.html} (70%) diff --git a/apps/school/templates/blocks/_schedule_purchased_item.html b/apps/school/templates/blocks/_schedule_purchased_item.html deleted file mode 100644 index b9d1db1f..00000000 --- a/apps/school/templates/blocks/_schedule_purchased_item.html +++ /dev/null @@ -1,78 +0,0 @@ -{% load static %} {% load thumbnail %} -
-
-
-
- {{ school_schedule }} -
- {% if live_lesson %} -
{{ live_lesson.date }}
- {% endif %} -
-
-
{{ school_schedule.start_at }} (МСК)
- {% if school_schedule.weekday in school_schedules_purchased %} - {% if live_lesson and live_lesson.title %} - {% include './open_lesson.html' %} - {% endif %} - {% else %} - {% include './day_pay_btn.html' %} - {% endif %} -
- {% comment %} - - {% endcomment %} - {% if school_schedule.weekday in school_schedules_purchased %} - - {% endif %} -
-
-
- {% thumbnail live_lesson.cover.image "70x70" crop="center" as im %} - - {% empty %} - - {% endthumbnail %} -
-
-
-
{{ school_schedule.title }}{% if live_lesson and live_lesson.title %}, - {{ live_lesson.title }} - {% endif %} -
-
- {% if live_lesson and live_lesson.short_description %} - {{ live_lesson.short_description }} - {% else %} - {{ school_schedule.description }} - {% endif %} -
-
-
Материалы
-
-
- {{ school_schedule.materials }} -
-
- {% if school_schedule.schoolschedule_images.exists %} -
Результаты прошлых уроков
- - {% endif %} -
-
-
- -
-
diff --git a/apps/school/templates/blocks/schedule.html b/apps/school/templates/blocks/schedule.html index 2e4c6457..5f088511 100644 --- a/apps/school/templates/blocks/schedule.html +++ b/apps/school/templates/blocks/schedule.html @@ -6,74 +6,7 @@
{% for school_schedule in school_schedules %} - {% with current_live_lesson=school_schedule.current_live_lesson %} -
-
-
-
- {{ school_schedule }} -
- {% if current_live_lesson %} - - {% endif %} -
-
-
{{ school_schedule.start_at }} (МСК)
- -
-
-
-
- {% thumbnail current_live_lesson.cover.image "70x70" crop="center" as im %} - - {% empty %} - - {% endthumbnail %} -
-
-
-
{{ school_schedule.title }} - {% if current_live_lesson and current_live_lesson.title %} - , {{ current_live_lesson.title }} - {% endif %} -
-
- {% if live_lesson %} - {{ live_lesson.short_description }} - {% else %} - {{ school_schedule.description }} - {% endif %} -
-
-
Материалы
-
-
- {{ school_schedule.materials }} -
-
- {% if school_schedule.schoolschedule_images.exists %} -
Результаты прошлых уроков
- - {% endif %} -
-
-
- -
-
- {% endwith %} + {% include 'blocks/schedule_item.html' with school_schedule=school_schedule live_lesson=school_schedule.current_live_lesson purchased=True %} {% endfor %}
diff --git a/apps/school/templates/summer/_schedule_purchased_item.html b/apps/school/templates/blocks/schedule_item.html similarity index 70% rename from apps/school/templates/summer/_schedule_purchased_item.html rename to apps/school/templates/blocks/schedule_item.html index 0e86ccba..0cafb9f3 100644 --- a/apps/school/templates/summer/_schedule_purchased_item.html +++ b/apps/school/templates/blocks/schedule_item.html @@ -1,21 +1,23 @@ {% load static %} {% load thumbnail %} -
+
{{ school_schedule }}
- {% if live_lesson %} + {% if purchased and live_lesson %}
{{ live_lesson.date }}
{% endif %} +
{{ school_schedule.start_at }} (МСК)
-
{{ school_schedule.start_at }} (МСК)
- {% if school_schedule.weekday in school_schedules_purchased %} - {% if live_lesson and live_lesson.title %} - {% include './open_lesson.html' %} + {% if purchased %} + {% if school_schedule.weekday in school_schedules_purchased %} + {% if live_lesson and live_lesson.title %} + {% include './open_lesson.html' %} + {% endif %} + {% else %} + {% include './day_pay_btn.html' %} {% endif %} - {% else %} - {% include './day_pay_btn.html' %} {% endif %}
@@ -36,7 +38,7 @@ {% endthumbnail %}
-
+
{{ school_schedule.title }}{% if live_lesson and live_lesson.title %}, {{ live_lesson.title }} {% endif %} @@ -51,11 +53,19 @@
Материалы
-
- {{ school_schedule.materials }} -
+ {% if print %} +
+
+ {{ school_schedule.materials }} +
+
+ {% else %} +
+ {{ school_schedule.materials }} +
+ {% endif %}
- {% if school_schedule.schoolschedule_images.exists %} + {% if not print and school_schedule.schoolschedule_images.exists %}
Результаты прошлых уроков
+ {% if not print %}
+ {% endif %}
diff --git a/apps/school/templates/blocks/schedule_purchased.html b/apps/school/templates/blocks/schedule_purchased.html index 7f8f035d..5d1a5827 100644 --- a/apps/school/templates/blocks/schedule_purchased.html +++ b/apps/school/templates/blocks/schedule_purchased.html @@ -41,10 +41,10 @@ {% for school_schedule in school_schedules %} {% if is_previous %} {% if school_schedule.previous_live_lesson in live_lessons %} - {% include './_schedule_purchased_item.html' with school_schedule=school_schedule live_lesson=school_schedule.previous_live_lesson %} + {% include 'blocks/schedule_item.html' with school_schedule=school_schedule live_lesson=school_schedule.previous_live_lesson purchased=True %} {% endif %} {% else %} - {% include './_schedule_purchased_item.html' with school_schedule=school_schedule live_lesson=school_schedule.current_live_lesson %} + {% include 'blocks/schedule_item.html' with school_schedule=school_schedule live_lesson=school_schedule.current_live_lesson purchased=True %} {% endif %} {% endfor %} {% endif %} diff --git a/apps/school/templates/school/schedules_print.html b/apps/school/templates/school/schedules_print.html index 25aca06e..66c936cb 100644 --- a/apps/school/templates/school/schedules_print.html +++ b/apps/school/templates/school/schedules_print.html @@ -11,70 +11,16 @@ - +
Расписание
- {% for school_schedule in school_schedules %} {% with current_live_lesson=school_schedule.current_live_lesson %} -
-
-
-
- {{ school_schedule }} -
- {% if current_live_lesson %} - - {% endif %} -
-
-
{{ school_schedule.start_at }} (МСК)
-
-
-
-
- {% thumbnail current_live_lesson.cover.image "70x70" crop="center" as im %} - {% empty %} - {% endthumbnail %} -
-
-
-
{{ school_schedule.title }}{% if current_live_lesson %}, - {{ current_live_lesson.title }} - {% endif %} -
-
- {% if live_lesson %} - {{ live_lesson.short_description }} - {% else %} - {{ school_schedule.description }} - {% endif %} -
-
-
Материалы
-
-
-
- {{ school_schedule.materials }} -
-
-
- - - - - - - - - - -
-
-
- {% endwith %} {% endfor %} + {% for school_schedule in school_schedules %} + {% include 'blocks/schedule_item.html' with school_schedule=school_schedule live_lesson=school_schedule.current_live_lesson print=True %} + {% endfor %}
diff --git a/apps/school/templates/summer/schedule_purchased.html b/apps/school/templates/summer/schedule_purchased.html index 63e963fd..e327fc96 100644 --- a/apps/school/templates/summer/schedule_purchased.html +++ b/apps/school/templates/summer/schedule_purchased.html @@ -41,10 +41,10 @@ {% for school_schedule in school_schedules %} {% if is_previous %} {% if school_schedule.previous_live_lesson in live_lessons %} - {% include './_schedule_purchased_item.html' with school_schedule=school_schedule live_lesson=school_schedule.previous_live_lesson %} + {% include 'blocks/schedule_item.html' with school_schedule=school_schedule live_lesson=school_schedule.previous_live_lesson purchased=True %} {% endif %} {% else %} - {% include './_schedule_purchased_item.html' with school_schedule=school_schedule live_lesson=school_schedule.current_live_lesson %} + {% include 'blocks/schedule_item.html' with school_schedule=school_schedule live_lesson=school_schedule.current_live_lesson purchased=True %} {% endif %} {% endfor %} {% endif %} diff --git a/web/src/sass/_common.sass b/web/src/sass/_common.sass index 8386a037..f9cee7ff 100755 --- a/web/src/sass/_common.sass +++ b/web/src/sass/_common.sass @@ -3782,6 +3782,7 @@ a.grey-link +m display: flex flex-direction: row + width: 100% &__day position: relative margin: 10px 0 5px @@ -3807,20 +3808,22 @@ a.grey-link margin: -3px 0 0 auto &__buy +m - display: flex - margin-left: 20px + flex: 1 0 0 + text-align: right &__time margin: 15px 0 opacity: .5 +m - width: 90px - margin: 0 + margin: -1px 15px + font-size: 12px; &__btn margin-right: -60px padding-left: 20px padding-right: 20px white-space: nowrap letter-spacing: 1px + +m + margin-right: 0 &__pic display: block width: 100% From b110eaad87d984d4243d3104ddd756c60dddd9cb Mon Sep 17 00:00:00 2001 From: Ivlev Denis Date: Thu, 19 Jul 2018 15:38:04 +0300 Subject: [PATCH 02/23] LIL-596. Fix non paid schedule template (cherry picked from commit 6760feb) --- apps/school/templates/blocks/schedule.html | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/apps/school/templates/blocks/schedule.html b/apps/school/templates/blocks/schedule.html index 2e4c6457..89ce9222 100644 --- a/apps/school/templates/blocks/schedule.html +++ b/apps/school/templates/blocks/schedule.html @@ -8,21 +8,25 @@ {% for school_schedule in school_schedules %} {% with current_live_lesson=school_schedule.current_live_lesson %}
-
+
{{ school_schedule }}
+ {% comment %} {% if current_live_lesson %} - +
{{ current_live_lesson.date }}
{% endif %} + {% endcomment %}
{{ school_schedule.start_at }} (МСК)
- + {% comment %} + {% include './pay_btn.html' %} + {% endcomment %}
-
+
{% thumbnail current_live_lesson.cover.image "70x70" crop="center" as im %} @@ -31,7 +35,7 @@ {% endthumbnail %}
-
+
{{ school_schedule.title }} {% if current_live_lesson and current_live_lesson.title %} , {{ current_live_lesson.title }} From 90f5eebcb7f19cca69694726668dc842d2a89a32 Mon Sep 17 00:00:00 2001 From: gzbender Date: Sat, 21 Jul 2018 01:36:05 +0500 Subject: [PATCH 03/23] =?UTF-8?q?LIL-597=20=D0=9F=D0=BE=D0=BA=D0=B0=D0=B7?= =?UTF-8?q?=D1=8B=D0=B2=D0=B0=D1=82=D1=8C=20=D0=B7=D0=B0=D0=BF=D0=B8=D1=81?= =?UTF-8?q?=D0=B8=20=D1=83=D1=80=D0=BE=D0=BA=D0=BE=D0=B2=20=D0=B7=D0=B0=20?= =?UTF-8?q?=D0=B2=D1=81=D1=91=20=D0=B2=D1=80=D0=B5=D0=BC=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/school/views.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/apps/school/views.py b/apps/school/views.py index 7f4ab734..90602ec0 100644 --- a/apps/school/views.py +++ b/apps/school/views.py @@ -223,8 +223,7 @@ class SummerSchoolView(TemplateView): school_schedules_purchased = [] if school_payment_exists and is_previous: live_lessons = LiveLesson.objects.filter( - date__gte=school_payment.last().date_start, - date__range=[(now_time - timedelta(days=8)).date(), (now_time - timedelta(days=1)).date()], + date__lt=(now_time - timedelta(days=1)).date(), deactivated_at__isnull=True, ) live_lessons_exists = live_lessons.exists() From 404c48c9b3d4bd221906e1b63e8ac680b90cd892 Mon Sep 17 00:00:00 2001 From: cfwme Date: Tue, 24 Jul 2018 07:42:34 +0000 Subject: [PATCH 04/23] Revert "Merge branch 'hotfix/lil-597' into 'master'" This reverts merge request !73 --- apps/school/views.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/school/views.py b/apps/school/views.py index 90602ec0..7f4ab734 100644 --- a/apps/school/views.py +++ b/apps/school/views.py @@ -223,7 +223,8 @@ class SummerSchoolView(TemplateView): school_schedules_purchased = [] if school_payment_exists and is_previous: live_lessons = LiveLesson.objects.filter( - date__lt=(now_time - timedelta(days=1)).date(), + date__gte=school_payment.last().date_start, + date__range=[(now_time - timedelta(days=8)).date(), (now_time - timedelta(days=1)).date()], deactivated_at__isnull=True, ) live_lessons_exists = live_lessons.exists() From 55bb4bb70cef8a5dad963f667577a56ac7bd4bd7 Mon Sep 17 00:00:00 2001 From: gzbender Date: Tue, 24 Jul 2018 18:26:01 +0500 Subject: [PATCH 05/23] =?UTF-8?q?LIL-597=20=D0=9F=D0=BE=D0=BA=D0=B0=D0=B7?= =?UTF-8?q?=D1=8B=D0=B2=D0=B0=D1=82=D1=8C=20=D0=B7=D0=B0=D0=BF=D0=B8=D1=81?= =?UTF-8?q?=D0=B8=20=D1=83=D1=80=D0=BE=D0=BA=D0=BE=D0=B2=20=D0=B7=D0=B0=20?= =?UTF-8?q?=D0=B2=D1=81=D1=91=20=D0=B2=D1=80=D0=B5=D0=BC=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../templates/summer/schedule_purchased.html | 20 ++++++----- apps/school/views.py | 33 +++++++++++++++---- 2 files changed, 38 insertions(+), 15 deletions(-) diff --git a/apps/school/templates/summer/schedule_purchased.html b/apps/school/templates/summer/schedule_purchased.html index 63e963fd..4de81091 100644 --- a/apps/school/templates/summer/schedule_purchased.html +++ b/apps/school/templates/summer/schedule_purchased.html @@ -38,15 +38,17 @@ {% if is_previous and not live_lessons_exists %} Записей уроков пока нет {% else %} - {% for school_schedule in school_schedules %} - {% if is_previous %} - {% if school_schedule.previous_live_lesson in live_lessons %} - {% include './_schedule_purchased_item.html' with school_schedule=school_schedule live_lesson=school_schedule.previous_live_lesson %} - {% endif %} - {% else %} - {% include './_schedule_purchased_item.html' with school_schedule=school_schedule live_lesson=school_schedule.current_live_lesson %} - {% endif %} - {% endfor %} + {% if is_previous %} + {% for live_lesson in live_lessons %} + {% if live_lesson.school_schedule %} + {% include './_schedule_purchased_item.html' with school_schedule=live_lesson.school_schedule live_lesson=live_lesson %} + {% endif %} + {% endfor %} + {% else %} + {% for school_schedule in school_schedules %} + {% include './_schedule_purchased_item.html' with school_schedule=school_schedule live_lesson=school_schedule.current_live_lesson %} + {% endfor %} + {% endif %} {% endif %}
diff --git a/apps/school/views.py b/apps/school/views.py index 7f4ab734..3c1b478a 100644 --- a/apps/school/views.py +++ b/apps/school/views.py @@ -4,7 +4,7 @@ from paymentwall import Pingback from django.contrib.auth import get_user_model from django.contrib.auth.decorators import login_required, user_passes_test from django.db.utils import IntegrityError -from django.db.models import Min, F, Func, Q +from django.db.models import Min, F, Func, Q, Value from django.http import Http404 from django.shortcuts import get_object_or_404 from django.utils.decorators import method_decorator @@ -174,6 +174,8 @@ class SummerSchoolView(TemplateView): context = super().get_context_data() is_previous = 'is_previous' in self.request.GET date_now = now().date() + yesterday = date_now - timedelta(days=1) + month_start = date_now.replace(day=1) now_time = now() try: school_schedule = SchoolSchedule.objects.get(weekday=now_time.isoweekday()) @@ -186,7 +188,24 @@ class SummerSchoolView(TemplateView): (end_at + timedelta(hours=1)).time() >= now_time.time() and school_schedule.current_live_lesson() ) + + school_schedules = SchoolSchedule.objects.all() + school_schedules_dict = {ss.weekday: ss for ss in school_schedules} + school_schedules_dict[0] = school_schedules_dict.get(7) if self.request.user.is_authenticated: + all_schedules_purchased = SchoolPayment.objects.filter( + user=self.request.user, + status__in=[ + Pingback.PINGBACK_TYPE_REGULAR, + Pingback.PINGBACK_TYPE_GOODWILL, + Pingback.PINGBACK_TYPE_RISK_REVIEWED_ACCEPTED, + ], + date_start__range=[month_start, date_now], + ).annotate( + joined_weekdays=Func(F('weekdays'), function='unnest',) + ).distinct().values_list('joined_weekdays', flat=True) + all_schedules_purchased = map(lambda x: 1 if x == 7 else x+1, all_schedules_purchased) + school_payment = SchoolPayment.objects.filter( user=self.request.user, status__in=[ @@ -221,12 +240,14 @@ class SummerSchoolView(TemplateView): school_payment_exists_future = False school_purchased_future = False school_schedules_purchased = [] - if school_payment_exists and is_previous: + if all_schedules_purchased and is_previous: live_lessons = LiveLesson.objects.filter( - date__gte=school_payment.last().date_start, - date__range=[(now_time - timedelta(days=8)).date(), (now_time - timedelta(days=1)).date()], + date__range=[month_start, yesterday], deactivated_at__isnull=True, - ) + date__week_day__in=all_schedules_purchased, + ).order_by('-date') + for ll in live_lessons: + ll.school_schedule = school_schedules_dict.get(ll.date.isoweekday()) live_lessons_exists = live_lessons.exists() else: live_lessons = None @@ -240,7 +261,7 @@ class SummerSchoolView(TemplateView): 'is_purchased': school_payment_exists, 'is_purchased_future': school_payment_exists_future, 'min_school_price': SchoolSchedule.objects.aggregate(Min('month_price'))['month_price__min'], - 'school_schedules': SchoolSchedule.objects.all(), + 'school_schedules': school_schedules, 'school_schedules_purchased': school_schedules_purchased, 'school_purchased_future': school_purchased_future, 'subscription_ends': school_payment.filter(add_days=False).first().date_end if school_payment_exists else None, From a4c9fc608cd14e75458df9127f5bd08c65e080a7 Mon Sep 17 00:00:00 2001 From: gzbender Date: Wed, 25 Jul 2018 16:00:35 +0500 Subject: [PATCH 06/23] =?UTF-8?q?fix=20in=20LIL-597=20=D0=9F=D0=BE=D0=BA?= =?UTF-8?q?=D0=B0=D0=B7=D1=8B=D0=B2=D0=B0=D1=82=D1=8C=20=D0=B7=D0=B0=D0=BF?= =?UTF-8?q?=D0=B8=D1=81=D0=B8=20=D1=83=D1=80=D0=BE=D0=BA=D0=BE=D0=B2=20?= =?UTF-8?q?=D0=B7=D0=B0=20=D0=B2=D1=81=D1=91=20=D0=B2=D1=80=D0=B5=D0=BC?= =?UTF-8?q?=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/school/views.py | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/school/views.py b/apps/school/views.py index 3c1b478a..982a2430 100644 --- a/apps/school/views.py +++ b/apps/school/views.py @@ -192,6 +192,7 @@ class SummerSchoolView(TemplateView): school_schedules = SchoolSchedule.objects.all() school_schedules_dict = {ss.weekday: ss for ss in school_schedules} school_schedules_dict[0] = school_schedules_dict.get(7) + all_schedules_purchased = [] if self.request.user.is_authenticated: all_schedules_purchased = SchoolPayment.objects.filter( user=self.request.user, From 1c20b3c328a25b9f5e694124da89e93cf6958755 Mon Sep 17 00:00:00 2001 From: gzbender Date: Wed, 25 Jul 2018 16:26:43 +0500 Subject: [PATCH 07/23] Fix LIL-560 --- apps/school/templates/blocks/schedule_item.html | 2 +- apps/school/templates/summer/schedule_purchased.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/school/templates/blocks/schedule_item.html b/apps/school/templates/blocks/schedule_item.html index 0cafb9f3..3895f575 100644 --- a/apps/school/templates/blocks/schedule_item.html +++ b/apps/school/templates/blocks/schedule_item.html @@ -28,7 +28,7 @@ {% endif %}
-
+
{% thumbnail live_lesson.cover.image "70x70" crop="center" as im %} diff --git a/apps/school/templates/summer/schedule_purchased.html b/apps/school/templates/summer/schedule_purchased.html index e320bb14..78faff49 100644 --- a/apps/school/templates/summer/schedule_purchased.html +++ b/apps/school/templates/summer/schedule_purchased.html @@ -41,7 +41,7 @@ {% if is_previous %} {% for live_lesson in live_lessons %} {% if live_lesson.school_schedule %} - {% include 'blocks/schedule_item.html' with school_schedule=school_schedule live_lesson=school_schedule.previous_live_lesson purchased=True %} + {% include 'blocks/schedule_item.html' with school_schedule=live_lesson.school_schedule live_lesson=live_lesson purchased=True %} {% endif %} {% endfor %} {% else %} From 5844d2877a08bde84568d58132fe14b0d3bf4dfa Mon Sep 17 00:00:00 2001 From: nikita Date: Fri, 27 Jul 2018 11:13:19 +0300 Subject: [PATCH 08/23] LIL-589 linebreak --- apps/course/templates/course/course_only_lessons.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/course/templates/course/course_only_lessons.html b/apps/course/templates/course/course_only_lessons.html index f0217bcf..fd0d489c 100644 --- a/apps/course/templates/course/course_only_lessons.html +++ b/apps/course/templates/course/course_only_lessons.html @@ -189,7 +189,7 @@
{% endif %} -
{{ lesson.short_description | truncatechars_html:800 | safe }}
+
{{ lesson.short_description | truncatechars_html:800 | safe | linebreaks }}
Перейти к уроку From e43e8901147cb562401fdfbafe0df6d529f24462 Mon Sep 17 00:00:00 2001 From: nikita Date: Fri, 27 Jul 2018 11:25:33 +0300 Subject: [PATCH 09/23] LIL-589 linebreaks --- apps/course/templates/course/content/imagetext.html | 2 +- apps/course/templates/course/course.html | 4 ++-- apps/school/templates/school/livelessons_list.html | 2 +- web/src/components/CourseRedactor.vue | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/course/templates/course/content/imagetext.html b/apps/course/templates/course/content/imagetext.html index 6385391e..80c6797a 100644 --- a/apps/course/templates/course/content/imagetext.html +++ b/apps/course/templates/course/content/imagetext.html @@ -9,7 +9,7 @@
-
{{ content.txt | safe }}
+
{{ content.txt | safe | linebreaks }}
diff --git a/apps/course/templates/course/course.html b/apps/course/templates/course/course.html index f5ba90af..15a54c12 100644 --- a/apps/course/templates/course/course.html +++ b/apps/course/templates/course/course.html @@ -70,7 +70,7 @@
{{ course.title }}
-
{{ course.short_description }}
+
{{ course.short_description | linebreaks }}
{{ course.title }}
-
{{ course.short_description }}
+
{{ course.short_description | linebreaks }}
{% if course.author.photo %} diff --git a/apps/school/templates/school/livelessons_list.html b/apps/school/templates/school/livelessons_list.html index b02e4f8d..b2099cbe 100644 --- a/apps/school/templates/school/livelessons_list.html +++ b/apps/school/templates/school/livelessons_list.html @@ -24,7 +24,7 @@
{{ livelesson.date }} // {{ livelesson.title }}
-
{{ livelesson.short_description }}
+
{{ livelesson.short_description | linebreaks }}
{% endfor %} diff --git a/web/src/components/CourseRedactor.vue b/web/src/components/CourseRedactor.vue index f4291156..28e10243 100644 --- a/web/src/components/CourseRedactor.vue +++ b/web/src/components/CourseRedactor.vue @@ -236,7 +236,7 @@
{{ lesson.title }}
-
{{ lesson.short_description }}
+
{{ lesson.short_description | linebreaks }}
From 0c71c73172ad74ada544eafdad5c97db67dd3908 Mon Sep 17 00:00:00 2001 From: gzbender Date: Tue, 31 Jul 2018 22:12:55 +0500 Subject: [PATCH 10/23] =?UTF-8?q?LIL-603=20=D0=97=D0=B0=D0=BA=D1=80=D1=8B?= =?UTF-8?q?=D1=82=D1=8C=20=D0=B2=D0=BE=D0=B7=D0=BC=D0=BE=D0=B6=D0=BD=D0=BE?= =?UTF-8?q?=D1=81=D1=82=D1=8C=20=D0=BA=D1=83=D0=BF=D0=B8=D1=82=D1=8C=20?= =?UTF-8?q?=D0=BB=D0=B0=D0=B3=D0=B5=D1=80=D1=8C=20=D1=81=2031.07?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../templates/summer/schedule_purchased.html | 3 +++ apps/school/views.py | 8 ++++++- project/context_processors.py | 21 +++++++++++++++++++ project/settings.py | 1 + project/templates/blocks/about.html | 2 ++ project/templates/blocks/header.html | 4 +++- project/templates/blocks/promo.html | 8 +++++-- 7 files changed, 43 insertions(+), 4 deletions(-) diff --git a/apps/school/templates/summer/schedule_purchased.html b/apps/school/templates/summer/schedule_purchased.html index 78faff49..4bd18774 100644 --- a/apps/school/templates/summer/schedule_purchased.html +++ b/apps/school/templates/summer/schedule_purchased.html @@ -25,12 +25,15 @@ {% else %}
Новые уроки
{% endif %} + + {% comment %}
запись уроков новые уроки + {% endcomment %}
{% endif %}
diff --git a/apps/school/views.py b/apps/school/views.py index 982a2430..ec7f9233 100644 --- a/apps/school/views.py +++ b/apps/school/views.py @@ -6,7 +6,7 @@ from django.contrib.auth.decorators import login_required, user_passes_test from django.db.utils import IntegrityError from django.db.models import Min, F, Func, Q, Value from django.http import Http404 -from django.shortcuts import get_object_or_404 +from django.shortcuts import get_object_or_404, redirect from django.utils.decorators import method_decorator from django.utils.timezone import now from django.views.generic import ListView, UpdateView, TemplateView, DetailView @@ -170,6 +170,12 @@ class SchoolView(TemplateView): class SummerSchoolView(TemplateView): template_name = 'school/summer_school.html' + def get(self, request, *args, **kwargs): + context = self.get_context_data(**kwargs) + if not context.get('is_purchased'): + return redirect('/') + return self.render_to_response(context) + def get_context_data(self): context = super().get_context_data() is_previous = 'is_previous' in self.request.GET diff --git a/project/context_processors.py b/project/context_processors.py index 0e7e9d32..e4788dc4 100644 --- a/project/context_processors.py +++ b/project/context_processors.py @@ -1,5 +1,9 @@ +from django.utils.timezone import now +from paymentwall.pingback import Pingback + from apps.config.models import Config from apps.content.models import Baner +from apps.payment.models import SchoolPayment def config(request): @@ -8,3 +12,20 @@ def config(request): def baner(request): return {'baner': Baner.objects.filter(use=True).first()} + + +def is_summer_school_purchased(request): + if request.user.is_authenticated: + n = now().date() + school_payment = SchoolPayment.objects.filter( + user=request.user, + status__in=[ + Pingback.PINGBACK_TYPE_REGULAR, + Pingback.PINGBACK_TYPE_GOODWILL, + Pingback.PINGBACK_TYPE_RISK_REVIEWED_ACCEPTED, + ], + date_start__lte=n, + date_end__gte=n + ) + return {'is_summer_school_purchased': school_payment.exists()} + return {'is_summer_school_purchased': False} diff --git a/project/settings.py b/project/settings.py index 9323745c..1aecdb8c 100644 --- a/project/settings.py +++ b/project/settings.py @@ -93,6 +93,7 @@ TEMPLATES = [ 'context_processors': [ 'project.context_processors.config', 'project.context_processors.baner', + 'project.context_processors.is_summer_school_purchased', 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', diff --git a/project/templates/blocks/about.html b/project/templates/blocks/about.html index 8deec906..5fefa4ca 100644 --- a/project/templates/blocks/about.html +++ b/project/templates/blocks/about.html @@ -44,6 +44,7 @@
+ {% comment %} {% if not is_purchased and not is_purchased_future %} {% endif %} + {% endcomment %}
diff --git a/project/templates/blocks/header.html b/project/templates/blocks/header.html index ae4107d1..5be001d8 100644 --- a/project/templates/blocks/header.html +++ b/project/templates/blocks/header.html @@ -25,13 +25,15 @@