diff --git a/apps/course/templates/course/course.html b/apps/course/templates/course/course.html index 15a54c12..53a56abc 100644 --- a/apps/course/templates/course/course.html +++ b/apps/course/templates/course/course.html @@ -158,13 +158,13 @@ {% else %} УРОКИ - {% if not paid %} + {% if not paid and course.price %} diff --git a/apps/course/templates/course/course_only_lessons.html b/apps/course/templates/course/course_only_lessons.html index fd0d489c..ff56ca65 100644 --- a/apps/course/templates/course/course_only_lessons.html +++ b/apps/course/templates/course/course_only_lessons.html @@ -154,10 +154,10 @@ {% else %} УРОКИ - {% if not paid %} + {% if not paid and course.price %} diff --git a/apps/course/views.py b/apps/course/views.py index 8cff720a..4a6a2658 100644 --- a/apps/course/views.py +++ b/apps/course/views.py @@ -190,7 +190,8 @@ class CourseView(DetailView): response = super().get(request, *args, **kwargs) context = self.get_context_data() if (not request.user.is_authenticated and self.object.status != Course.PUBLISHED) or\ - (request.user.is_authenticated and request.user.role < User.AUTHOR_ROLE and self.object.author != request.user and self.only_lessons and not context['paid']): + (request.user.is_authenticated and request.user.role != User.ADMIN_ROLE and self.object.author != request.user + and self.only_lessons and self.object.price and not context['paid']): raise Http404 return response @@ -292,7 +293,15 @@ class LessonView(DetailView): def get(self, request, *args, **kwargs): response = super().get(request, *args, **kwargs) - if (self.object.course.status != Course.PUBLISHED and not + paid = self.object.course.payments.filter( + user=self.request.user, + status__in=[ + Pingback.PINGBACK_TYPE_REGULAR, + Pingback.PINGBACK_TYPE_GOODWILL, + Pingback.PINGBACK_TYPE_RISK_REVIEWED_ACCEPTED, + ], + ).exists() + if ((self.object.course.status != Course.PUBLISHED or (self.object.course.price and not paid)) and not (request.user.role == User.ADMIN_ROLE or self.object.course.author == request.user)): raise Http404 diff --git a/project/templates/blocks/popup_course_lock.html b/project/templates/blocks/popup_course_lock.html index 75053862..45f87ae0 100644 --- a/project/templates/blocks/popup_course_lock.html +++ b/project/templates/blocks/popup_course_lock.html @@ -5,8 +5,8 @@ ЧТОБЫ ПРОДОЛЖИТЬ ПРОСМОТР - Как просто научиться рисовать простых персонажей. - Этот курс поможет детям узнать о том как из простых форм создавать веселый и харизматичных персонажей. + {{ course.title }} + {{ course.short_description }} КУПИТЬ КУРС