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

remotes/origin/feature/lil-592
gzbender 8 years ago
parent e43e890114
commit 0c71c73172
  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 %}
<div class="casing__title title">Новые уроки</div>
{% endif %}
{% comment %}
<label class="casing__switcher switcher">
<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' %}" class="switcher__item{% if not is_previous %} active{% endif %}">новые уроки</a>
</span>
</label>
{% endcomment %}
</div>
{% endif %}
<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.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

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

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

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

@ -25,13 +25,15 @@
</form>
</div>
<nav class="header__nav">
{% if is_summer_school_purchased %}
<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 %}
<div class="header__dot"></div>
{% endif %}
</a>
</div>
{% endif %}
<div class="header__group">
<a class="header__section {% active_link 'school:school' %}" href="{% url 'school:school' %}">
ОНЛАЙН-ШКОЛА {% if online or livelesson.is_online %}

@ -46,9 +46,11 @@
</div>
{% else %}
<div class="main__subtitle">
Присоединяйтесь в Рисовальный лагерь
{# Присоединяйтесь в Рисовальный лагерь #}
Приглашаем вас на месяц открытых дверей в Lil School
</div>
<div class="main__actions">
{% comment %}
{% if not is_purchased and not is_purchased_future %}
<a
{% if not is_purchased_future %}
@ -64,7 +66,9 @@
Получить доступ
</a>
{% 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>
{% endif %}
</div>

Loading…
Cancel
Save