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

LIL-603 Закрыть возможность купить лагерь с 31.07

See merge request lilcity/backend!80
remotes/origin/feature/lil-592
cfwme 8 years ago
commit 89165ffbda
  1. 3
      apps/school/templates/summer/schedule_purchased.html
  2. 8
      apps/school/views.py
  3. 21
      project/context_processors.py
  4. 1
      project/settings.py
  5. 2
      project/templates/blocks/about.html
  6. 4
      project/templates/blocks/header.html
  7. 8
      project/templates/blocks/promo.html

@ -25,12 +25,15 @@
{% else %} {% else %}
<div class="casing__title title">Новые уроки</div> <div class="casing__title title">Новые уроки</div>
{% endif %} {% endif %}
{% comment %}
<label class="casing__switcher switcher"> <label class="casing__switcher switcher">
<span class="switcher__wrap"> <span class="switcher__wrap">
<a href="{% url 'school:summer-school' %}?is_previous=true" class="switcher__item{% if is_previous %} active{% endif %}">запись уроков</a> <a href="{% url 'school:summer-school' %}?is_previous=true" class="switcher__item{% if is_previous %} active{% endif %}">запись уроков</a>
<a href="{% url 'school:summer-school' %}" class="switcher__item{% if not is_previous %} active{% endif %}">новые уроки</a> <a href="{% url 'school:summer-school' %}" class="switcher__item{% if not is_previous %} active{% endif %}">новые уроки</a>
</span> </span>
</label> </label>
{% endcomment %}
</div> </div>
{% endif %} {% endif %}
<div class="casing__timing timing js-timing"> <div class="casing__timing timing js-timing">

@ -6,7 +6,7 @@ from django.contrib.auth.decorators import login_required, user_passes_test
from django.db.utils import IntegrityError from django.db.utils import IntegrityError
from django.db.models import Min, F, Func, Q, Value from django.db.models import Min, F, Func, Q, Value
from django.http import Http404 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.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
@ -170,6 +170,12 @@ class SchoolView(TemplateView):
class SummerSchoolView(TemplateView): class SummerSchoolView(TemplateView):
template_name = 'school/summer_school.html' 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): def get_context_data(self):
context = super().get_context_data() context = super().get_context_data()
is_previous = 'is_previous' in self.request.GET is_previous = 'is_previous' in self.request.GET

@ -1,5 +1,9 @@
from django.utils.timezone import now
from paymentwall.pingback import Pingback
from apps.config.models import Config from apps.config.models import Config
from apps.content.models import Baner from apps.content.models import Baner
from apps.payment.models import SchoolPayment
def config(request): def config(request):
@ -8,3 +12,20 @@ def config(request):
def baner(request): def baner(request):
return {'baner': Baner.objects.filter(use=True).first()} 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}

@ -93,6 +93,7 @@ TEMPLATES = [
'context_processors': [ 'context_processors': [
'project.context_processors.config', 'project.context_processors.config',
'project.context_processors.baner', 'project.context_processors.baner',
'project.context_processors.is_summer_school_purchased',
'django.template.context_processors.debug', 'django.template.context_processors.debug',
'django.template.context_processors.request', 'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth', 'django.contrib.auth.context_processors.auth',

@ -44,6 +44,7 @@
</div> </div>
</div> </div>
<div class="letsgo"> <div class="letsgo">
{% comment %}
{% if not is_purchased and not is_purchased_future %} {% if not is_purchased and not is_purchased_future %}
<a <a
{% if not user.is_authenticated %} {% if not user.is_authenticated %}
@ -57,6 +58,7 @@
купить доступ от {{ min_school_price }} руб./месяц купить доступ от {{ min_school_price }} руб./месяц
</a> </a>
{% endif %} {% endif %}
{% endcomment %}
</div> </div>
</div> </div>
</div> </div>

@ -25,13 +25,15 @@
</form> </form>
</div> </div>
<nav class="header__nav"> <nav class="header__nav">
{% if is_summer_school_purchased %}
<div class="header__group"> <div class="header__group">
<a class="header__section {% active_link 'school:summer-school' %}" href="{% url 'school:summer-school' %}"> <a class="header__section {% active_link 'school:summer-school' %}" href="{% url 'school:summer-school' %}?is_previous=true">
ЛАГЕРЬ {% if online or livelesson.is_online %} ЛАГЕРЬ {% if online or livelesson.is_online %}
<div class="header__dot"></div> <div class="header__dot"></div>
{% endif %} {% endif %}
</a> </a>
</div> </div>
{% endif %}
<div class="header__group"> <div class="header__group">
<a class="header__section {% active_link 'school:school' %}" href="{% url 'school:school' %}"> <a class="header__section {% active_link 'school:school' %}" href="{% url 'school:school' %}">
ОНЛАЙН-ШКОЛА {% if online or livelesson.is_online %} ОНЛАЙН-ШКОЛА {% if online or livelesson.is_online %}

@ -46,9 +46,11 @@
</div> </div>
{% else %} {% else %}
<div class="main__subtitle"> <div class="main__subtitle">
Присоединяйтесь в Рисовальный лагерь {# Присоединяйтесь в Рисовальный лагерь #}
Приглашаем вас на месяц открытых дверей в Lil School
</div> </div>
<div class="main__actions"> <div class="main__actions">
{% comment %}
{% if not is_purchased and not is_purchased_future %} {% if not is_purchased and not is_purchased_future %}
<a <a
{% if not is_purchased_future %} {% if not is_purchased_future %}
@ -64,7 +66,9 @@
Получить доступ Получить доступ
</a> </a>
{% endif %} {% endif %}
<a class="main__btn btn btn_white" href="{% url 'school:summer-school' %}">О лагере</a> {% endcomment %}
{# <a class="main__btn btn btn_white" href="{% url 'school:summer-school' %}">О лагере</a> #}
<a class="main__btn btn btn_white" href="{% url 'course' pk=50 %}">Подробнее</a>
</div> </div>
{% endif %} {% endif %}
</div> </div>

Loading…
Cancel
Save