Merge branch 'hotfix/dev-courses-26-8' into 'master'

Настроить на DEV нормальную работу курсов

See merge request lilschool/site!390
remotes/origin/ga-ecommerce-gleb
Danil 6 years ago
commit 2e3fea375b
  1. 14
      apps/auth/views.py
  2. 13
      apps/content/models.py
  3. 4
      apps/course/templates/course/_items.html
  4. 12
      apps/course/templates/course/course.html
  5. 4
      apps/school/templates/school/livelesson_detail_unauth.html
  6. 6
      apps/user/models.py
  7. 3
      docker/.env.review
  8. 20
      project/settings.py
  9. 5
      project/templates/blocks/partners.html
  10. 4
      project/templates/blocks/students.html
  11. 8
      project/templates/lilcity/home.html
  12. 23
      project/utils/db.py
  13. BIN
      web/src/img/girl-brushes.png
  14. BIN
      web/src/img/uni_mitsubishi.png
  15. 21
      web/src/sass/_common.sass

@ -1,31 +1,30 @@
import os
import logging
from uuid import uuid4
from urllib.parse import urlsplit
from facepy import GraphAPI
from facepy.exceptions import FacepyError
from django.contrib.auth import get_user_model, logout, login, views
from django.contrib.auth.forms import AuthenticationForm
from django.core.files.base import ContentFile
from django.http import JsonResponse, Http404
from django.http import JsonResponse
from django.urls import reverse_lazy
from django.utils.decorators import method_decorator
from django.views.decorators.csrf import csrf_exempt
from django.views.generic import FormView, View, TemplateView
from django.views.generic.edit import BaseFormView
from django.shortcuts import redirect
from django.conf import settings
from apps.notification.utils import send_email
from apps.config.models import Config
from apps.user.models import Referral
from .forms import LearnerRegistrationForm
from .tokens import verification_email_token
User = get_user_model()
logger = logging.getLogger(__name__)
class LearnerRegistrationView(FormView):
@ -75,7 +74,10 @@ class LearnerRegistrationView(FormView):
http_referer = str(http_referer[0]) + '://' + str(http_referer[1])
token = verification_email_token.make_token(user)
url = http_referer + str(reverse_lazy('lilcity:verification-email', args=[token, user.id]))
send_email('Вы успешно прошли регистрацию', email, "notification/email/verification_email.html", url=url, config=config)
try:
send_email('Вы успешно прошли регистрацию', email, "notification/email/verification_email.html", url=url, config=config)
except Exception as e:
logger.error(str(e))
if self.request.is_ajax():
return JsonResponse({"success": True}, status=201)

@ -9,15 +9,19 @@ from django.utils import timezone
from django.contrib.postgres.fields import ArrayField
from imagekit.models import ImageSpecField
from imagekit.processors import ResizeToCover
from polymorphic.models import PolymorphicModel
from project.utils.db import SafeImageField
User = get_user_model()
class ImageObject(models.Model):
image = models.ImageField('Изображение', upload_to='content/imageobject')
if settings.DEV_SERVER:
image = SafeImageField('Изображение', upload_to='content/imageobject')
else:
image = models.ImageField('Изображение', upload_to='content/imageobject')
image_thumbnail = ImageSpecField(source='image',
processors=[ResizeToCover(300, 200, False)],
format='JPEG',
@ -158,7 +162,6 @@ class Banner(models.Model):
text = models.TextField(blank=True, default='')
button_text = models.CharField(max_length=50, blank=True, default='')
url = models.URLField(blank=True, default='')
image = models.ImageField()
use = models.BooleanField(default=False)
color = models.CharField(max_length=7, blank=True, default='')
color2 = models.CharField(max_length=7, blank=True, default='')
@ -168,6 +171,10 @@ class Banner(models.Model):
update_at = models.DateTimeField(auto_now=True)
pages = ArrayField(models.IntegerField(choices=PAGE_CHOICES), default=[], blank=True)
main_banner = ArrayField(models.IntegerField(choices=PAGE_CHOICES), default=[], blank=True)
if settings.DEV_SERVER:
image = SafeImageField()
else:
image = models.ImageField()
class Meta:
verbose_name = 'Банер'

@ -9,9 +9,9 @@
>
<a class="courses__preview" href="{% if course.status <= 1 %}{% url 'course_edit' course.id %}{% else %}{{ course.url }}{% endif %}">
{% if course.cover and course.cover.image_thumbnail %}
<img class="courses__pic" src="{{ course.cover.image_thumbnail.url }}" width="{{ course.cover.image_thumbnail.width }}" />
<img class="courses__pic" src="{{ course.cover.image_thumbnail.url }}" />
{% else %}
<img class="courses__pic" src="{% static 'img/no_cover.png' %}" width="300px" />
<img class="courses__pic" src="{% static 'img/no_cover.png' %}" />
{% endif %}
{% if course.is_featured %}
<div class="courses__label courses__label_fav"></div>

@ -10,13 +10,13 @@
{% block ogurl %}{{ request.build_absolute_uri }}{% endblock ogurl %}
{% block ogimage %}
http://{{request.META.HTTP_HOST}}{% if course.cover and course.cover.image %}{{ course.cover.image.url }}{% else %}{% static 'img/og_courses.jpg' %}{% endif %}
http://{{request.META.HTTP_HOST}}{% if course.cover %}{{ course.cover.image.url }}{% else %}{% static 'img/og_courses.jpg' %}{% endif %}
{% endblock ogimage %}
{% block ogimage-width %}
{% if course.cover and course.cover.image %}{{ course.cover.image.width }}{% else %}1024{% endif %}
{% if course.cover %}{{ course.cover.image.width|default:'1024' }}{% else %}1024{% endif %}
{% endblock ogimage-width %}
{% block ogimage-height %}
{% if course.cover and course.cover.image %}{{ course.cover.image.height }}{% else %}512{% endif %}
{% if course.cover %}{{ course.cover.image.height|default:'512' }}{% else %}512{% endif %}
{% endblock ogimage-height %}
@ -212,10 +212,8 @@
{% endif %}
</div>
<a class="course__video video" href="#">
{% if course.cover and course.cover.image %}
{% if course.cover %}
<img class="video__pic" src="{{ course.cover.image.url }}"/>
{% else %}
{% endif %}
{% if course.is_deferred_start %}
<div class="video__soon">
@ -272,7 +270,7 @@
{% endif %}
<div
class="course course_promo"
style="background-image: url({% if course.cover and course.cover.image %}{{ course.cover.image.url }}{% else %}{% static 'img/no_cover.png' %}{% endif %});"
style="background-image: url({% if course.cover %}{{ course.cover.image.url }}{% else %}{% static 'img/no_cover.png' %}{% endif %});"
>
<div class="course__center center center_sm">
<div class="course__head">

@ -9,10 +9,10 @@
{% if livelesson.cover and livelesson.cover.image %}http://{{request.META.HTTP_HOST}}{{ livelesson.cover.image.url }}{% else %}{{ block.super }}{% endif %}
{% endblock ogimage %}
{% block ogimage-width %}
{% if livelesson.cover and livelesson.cover.image %}{{ livelesson.cover.image.width }}{% else %}{{ block.super }}{% endif %}
{% if livelesson.cover and livelesson.cover.image %}{{ livelesson.cover.image.width|default:'1024' }}{% else %}{{ block.super }}{% endif %}
{% endblock ogimage-width %}
{% block ogimage-height %}
{% if livelesson.cover and livelesson.cover.image %}{{ livelesson.cover.image.height }}{% else %}{{ block.super }}{% endif %}
{% if livelesson.cover and livelesson.cover.image %}{{ livelesson.cover.image.height|default:'512' }}{% else %}{{ block.super }}{% endif %}
{% endblock ogimage-height %}
{% block content %}

@ -19,6 +19,7 @@ from django.urls import reverse
from api.v1 import serializers
from apps.notification.utils import send_email
from apps.user.tasks import user_to_mixpanel
from project.utils.db import SafeImageField
class UserManager(BaseUserManager):
@ -79,7 +80,10 @@ class User(AbstractUser):
is_email_proved = models.BooleanField(
'Верифицирован по email', default=False
)
photo = models.ImageField('Фото', null=True, blank=True, upload_to='users')
if settings.DEV_SERVER:
photo = SafeImageField('Фото', null=True, blank=True, upload_to='users')
else:
photo = models.ImageField('Фото', null=True, blank=True, upload_to='users')
show_in_mainpage = models.BooleanField('Показывать на главной странице', default=False)
trial_lesson = models.URLField(default='', null=True, blank=True)
slug = models.SlugField(

@ -1,4 +1,5 @@
DEBUG=True
DEV_SERVER=True
ALLOWED_HOSTS=*
PORT=8000
CORS_ORIGIN_WHITELIST=lilcity.9ev.ru:8080
@ -9,7 +10,7 @@ POSTGRES_PASSWORD=GPVs/E/{5&qe
DJANGO_SETTINGS_MODULE=project.settings
DATABASE_SERVICE_HOST=db
SECRET_KEY=jelm*91lj(_-o20+6^a+bgv!4s6e_efry^#+f#=1ak&s1xr-2j
MAILGUN_API_KEY=key-ec6af2d43d031d59bff6b1c8fb9390c
MAILGUN_API_KEY=key-ec6af2d43d031d59bff6b1c8fb9390cb
MAILGUN_SENDER_DOMAIN=mail.9ev.ru
DEFAULT_FROM_EMAIL=postmaster@mail.9ev.ru
TWILIO_ACCOUNT=ACdf4a96b776cc764bc3ec0f0e136ba550

@ -30,6 +30,7 @@ SECRET_KEY = os.getenv(
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = os.getenv('DEBUG', False)
DEV_SERVER = os.getenv('DEV_SERVER', False)
ALLOWED_HOSTS = os.getenv('ALLOWED_HOSTS', '*').split(',')
MAIN_HOST = os.getenv('MAIN_HOST', 'lil.school')
@ -372,14 +373,6 @@ else:
# Mixpanel settings
MIX_TOKEN = os.getenv('MIXPANEL_TOKEN', '79bd6bfd98667ed977737e6810b8abcd')
# CORS settings
if DEBUG:
CORS_ORIGIN_ALLOW_ALL = True
else:
CORS_ORIGIN_WHITELIST = os.getenv(
'CORS_ORIGIN_WHITELIST', 'lilcity.9ev.ru:8080').split(',')
# Swagger doc settings
SWAGGER_SETTINGS = {
@ -410,3 +403,14 @@ try:
from .local_settings import *
except ImportError:
pass
# CORS settings
if DEBUG or DEV_SERVER:
CORS_ORIGIN_ALLOW_ALL = True
else:
CORS_ORIGIN_WHITELIST = os.getenv(
'CORS_ORIGIN_WHITELIST', 'lilcity.9ev.ru:8080').split(',')
if DEV_SERVER:
IMAGEKIT_DEFAULT_CACHEFILE_STRATEGY = 'imagekit.cachefiles.strategies.Optimistic'

@ -37,6 +37,11 @@
<img class="partners__pic" src="{% static 'img/gamma.png' %}">
</a>
</div>
<div class="partners__item">
<a target="_blank" href="http://unipen.ru/">
<img class="partners__pic" src="{% static 'img/uni_mitsubishi.png' %}">
</a>
</div>
</div>
</div>
</div>

@ -18,12 +18,12 @@
<div class="section__column section__column_text">
<div class="section__quote">
<div class="section__quote-text">
Лил Скул для меня это место, где Солнце может быть синего цвета.
Лил Скул для меня это место,<br>где Солнце может быть синего цвета.
</div>
<div class="section__quote-name">Злата Пыльцина, 7 лет. Город Волгоград.</div>
</div>
<div class="section__buttons">
<a class="btn js-video-modal" style="width: auto;"
<a class="btn js-video-modal"
data-video-url="https://www.youtube.com/watch?v=QrlR5sL_eGI"
href="#">Видео отзыв</a>
</div>

@ -10,6 +10,14 @@
{% endif %}
{% endblock ogdescription %}
{% block head %}
<style>
.section_main .title {
font-weight: bold;
}
</style>
{% endblock head %}
{% block title %}Lil School{% endblock title %}
{% block body_attr %}class="main-page"{% endblock body_attr %}
{% block content %}

@ -1,5 +1,28 @@
from django.db.models.base import ModelBase
from django.db import connection
from django.db import models
from django.db.models.fields.files import ImageFieldFile
class SafeImageFieldFile(ImageFieldFile):
@property
def width(self):
try:
return self.width
except:
return None
@property
def height(self):
try:
return self.height
except:
return None
class SafeImageField(models.ImageField):
attr_class = SafeImageFieldFile
class ModelFieldsNames(object):

Binary file not shown.

After

Width:  |  Height:  |  Size: 645 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

@ -1158,12 +1158,14 @@ a[name]
padding-bottom: 0
&_students &__column_img
background-image: url(/static/img/zlata.png)
background-image: url(/static/img/girl-brushes.png)
height: 400px
background-position: bottom center
z-index: -1
+m
height: auto
flex: 195px
background-size: 225px
&_students &__center:nth-child(1)
+m
@ -1174,11 +1176,17 @@ a[name]
+m
margin-top: 0
flex-direction: column-reverse
&_students &__center:nth-child(2) &__column_text
+m
padding: 0 0 0 10px
&_students .btn
width: auto
+m
width: 225px
&_course .go
flex-wrap: wrap
@ -1190,6 +1198,7 @@ a[name]
+m
font-size: 14px
padding: 55px 35px 100px 150px
&:before
background-image: url(/static/img/bubble-icon.svg?196dc3af196a)
@ -1199,16 +1208,18 @@ a[name]
width: 100%
height: 80%
content: ' '
left: -2%
left: 0
top: -3%
z-index: -1
+m
width: 90%;
left: 15%
width: 73%
left: 20%
top: 10%
& &-text
margin-bottom: 20px
+m
margin-bottom: 15px
& &-name
text-decoration: underline

Loading…
Cancel
Save