Merge branch 'hotfix/lil-607' into 'master'

Hotfix/lil 607

See merge request lilcity/backend!83
remotes/origin/feature/lil-592
cfwme 8 years ago
commit 999cc68bc4
  1. 4
      apps/course/templates/course/course.html
  2. 4
      apps/course/templates/course/course_only_lessons.html
  3. 13
      apps/course/views.py
  4. 4
      project/templates/blocks/popup_course_lock.html

@ -158,13 +158,13 @@
{% else %}
<a
class="course__action btn btn_lg{% if only_lessons %} btn_stroke{% else %} btn_gray{% endif %}"
{% if paid %}
{% if paid or not course.price %}
href="{% url 'course-only-lessons' course.id %}"
{% else %}
data-popup=".js-popup-course-lock"
{% endif %}
>УРОКИ
{% if not paid %}
{% if not paid and course.price %}
<svg class="icon icon-lock">
<use xlink:href="{% static 'img/sprite.svg' %}#icon-lock"></use>
</svg>

@ -154,10 +154,10 @@
</a>
{% else %}
<a
href="{% if paid %}{% url 'course-only-lessons' course.id %}{% else %}#{% endif %}"
href="{% if paid or not course.price %}{% url 'course-only-lessons' course.id %}{% else %}#{% endif %}"
class="course__action btn btn_lg{% if only_lessons %} btn_stroke{% else %} btn_gray{% endif %}"
>УРОКИ
{% if not paid %}
{% if not paid and course.price %}
<svg class="icon icon-lock">
<use xlink:href="{% static 'img/sprite.svg' %}#icon-lock"></use>
</svg>

@ -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

@ -5,8 +5,8 @@
<div class="popup__body">
<div class="lock">
<div class="lock__label">ЧТОБЫ ПРОДОЛЖИТЬ ПРОСМОТР</div>
<div class="lock__title title">Как просто научиться рисовать простых персонажей.</div>
<div class="lock__content">Этот курс поможет детям узнать о том как из простых форм создавать веселый и харизматичных персонажей.</div>
<div class="lock__title title">{{ course.title }}</div>
<div class="lock__content">{{ course.short_description }}</div>
<a href="{% url 'course-checkout' course.id %}" class="lock__btn btn">КУПИТЬ КУРС</a>
</div>
</div>

Loading…
Cancel
Save