Merge branch 'feature/new-certs-1-10-19' into 'master'

Feature/new certs 1 10 19

See merge request lilschool/site!418
remotes/origin/feature/landing-registration
Danil 6 years ago
commit dd13d0302b
  1. 15
      apps/notification/tasks.py
  2. 3
      apps/notification/templates/notification/email/certificate.html
  3. 2
      project/settings.py
  4. BIN
      resources/signed-user-certificates/1.jpg
  5. BIN
      resources/signed-user-certificates/2.jpg
  6. BIN
      resources/signed-user-certificates/3.jpg
  7. BIN
      resources/signed-user-certificates/4.jpg
  8. BIN
      resources/signed-user-certificates/5.jpg
  9. BIN
      resources/signed-user-certificates/6.jpg
  10. BIN
      resources/signed-user-certificates/7.jpg
  11. BIN
      resources/signed-user-certificates/8.jpg
  12. BIN
      resources/signed-user-certificates/9.jpg
  13. BIN
      web/src/img/signed-user-certificates/1.jpg
  14. BIN
      web/src/img/signed-user-certificates/2.jpg
  15. BIN
      web/src/img/signed-user-certificates/3.jpg
  16. BIN
      web/src/img/signed-user-certificates/4.jpg
  17. BIN
      web/src/img/signed-user-certificates/5.jpg
  18. BIN
      web/src/img/signed-user-certificates/6.jpg
  19. BIN
      web/src/img/signed-user-certificates/7.jpg
  20. BIN
      web/src/img/signed-user-certificates/8.jpg
  21. BIN
      web/src/img/signed-user-certificates/9.jpg
  22. BIN
      web/src/img/user-certificates/1.jpg
  23. BIN
      web/src/img/user-certificates/2.jpg
  24. BIN
      web/src/img/user-certificates/3.jpg
  25. BIN
      web/src/img/user-certificates/4.jpg
  26. BIN
      web/src/img/user-certificates/5.jpg
  27. BIN
      web/src/img/user-certificates/6.jpg
  28. BIN
      web/src/img/user-certificates/7.jpg
  29. BIN
      web/src/img/user-certificates/8.jpg
  30. BIN
      web/src/img/user-certificates/9.jpg
  31. 16
      web/webpack.config.js

@ -50,10 +50,10 @@ def draw_cert(path, email, first_name, last_name, x=None, y=900, color=(29, 115,
@app.task
def send_certificates(email=None, date_end=None, dry_run=False):
path_pattern = 'img/user-certificates/%d.jpg'
signed_path_pattern = 'img/signed-user-certificates/%d.jpg'
path_pattern = 'user-certificates/%d.jpg'
signed_path_pattern = 'signed-user-certificates/%d.jpg'
if email:
fn = draw_cert(staticfiles_storage.path(signed_path_pattern % 1), email, 'Имя', 'Фамилия')
fn = draw_cert(os.path.join(settings.RESOURCES_ROOT, signed_path_pattern % 1), email, 'Имя', 'Фамилия')
file = open(fn, 'rb')
try:
send_email('Грамота от Lil School', email, 'notification/email/certificate.html',
@ -85,19 +85,20 @@ def send_certificates(email=None, date_end=None, dry_run=False):
file_names = []
un.certificate_number = un.certificate_number + 1 \
if un.certificate_number and staticfiles_storage.exists(path_pattern % (un.certificate_number + 1)) \
if un.certificate_number and os.path.isfile(os.path.join(settings.RESOURCES_ROOT,
path_pattern % (un.certificate_number + 1))) \
else 1
if un.user.child_filled:
fn = staticfiles_storage.path(signed_path_pattern % un.certificate_number)
fn = os.path.join(settings.RESOURCES_ROOT, signed_path_pattern % un.certificate_number)
for child in un.user.childs.all():
file_names.append(draw_cert(fn, un.user.email, child.first_name, child.last_name))
else:
file_names.append(staticfiles_storage.path(path_pattern % un.certificate_number))
file_names.append(os.path.join(settings.RESOURCES_ROOT, signed_path_pattern % un.certificate_number))
files = [open(fn, 'rb') for fn in file_names]
try:
send_email('Грамота от Lil School', un.user.email, 'notification/email/certificate.html',
attachments=[(f.name, f.read(), 'image/jpeg') for f in files], user_notification=un,
many_childs=un.user.childs.all().count() > 1)
many_childs=un.user.childs.all().count() > 1, child_filled=un.user.child_filled)
except:
print('Not OK')
continue

@ -6,7 +6,8 @@
{% if not user_notification or user_notification.certificate_number == 1 %}
<p>
Поздравляем! Вы прошли месяц обучения в Lil School.<br>
К письму {% if many_childs %}прикреплены грамоты. Распечатайте их{% else %}прикреплена грамота. Распечатайте её{% endif %} и вручите вашим детям.<br>
К письму {% if many_childs %}прикреплены грамоты. Распечатайте их и вручите вашим детям.
{% else %}прикреплена грамота. Распечатайте её{% if not child_filled %}, подпишите{% endif %} и вручите вашему ребенку.{% endif %}<br>
Ждём вас в следующем месяце на наших творческих занятиях!
</p>
{% endif %}

@ -329,7 +329,7 @@ CELERY_BEAT_SCHEDULE = {
},
'send_certificates': {
'task': 'apps.notification.tasks.send_certificates',
'schedule': crontab(minute=0, hour=21),
'schedule': crontab(minute=30, hour=19),
'args': (),
},
'sendgrid_update_recipients': {

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 987 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 941 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 MiB

@ -21,7 +21,6 @@ module.exports = {
mixpanel: "./src/js/third_party/mixpanel-2-latest.js",
sprite: glob('./src/icons/*.svg'),
images: glob('./src/img/*.*'),
imagesCertificates: glob('./src/img/user-certificates/*'),
imagesGiftCertificates: glob('./src/img/gift-certificates/*'),
imagesReviews: glob('./src/img/reviews/*'),
fonts: glob('./src/fonts/*'),
@ -94,21 +93,10 @@ module.exports = {
},
{
test: /\.(png|gif|jpg|svg)$/,
exclude: [path.resolve(__dirname, 'src/icons'), path.resolve(__dirname, 'src/img/user-certificates'),
path.resolve(__dirname, 'src/img/gift-certificates'), path.resolve(__dirname, 'src/img/reviews'),
path.resolve(__dirname, 'src/img/signed-user-certificates')],
exclude: [path.resolve(__dirname, 'src/icons'),
path.resolve(__dirname, 'src/img/gift-certificates'), path.resolve(__dirname, 'src/img/reviews')],
loader: 'file-loader?name=[name].[ext]&outputPath=./img/'
},
{
test: /\.(png|jpg)$/,
include: path.resolve(__dirname, 'src/img/user-certificates'),
loader: 'file-loader?name=[name].[ext]&outputPath=./img/user-certificates/'
},
{
test: /\.(png|jpg)$/,
include: path.resolve(__dirname, 'src/img/signed-user-certificates'),
loader: 'file-loader?name=[name].[ext]&outputPath=./img/signed-user-certificates/'
},
{
test: /\.(png|jpg)$/,
include: path.resolve(__dirname, 'src/img/gift-certificates'),

Loading…
Cancel
Save