поздравительная открытка на день рождения

remotes/origin/feature/birthday-postcard-25-04-19
gzbender 7 years ago
parent c043d3b956
commit de02b42d55
  1. 11
      apps/notification/tasks.py
  2. 13
      apps/notification/templates/notification/email/birthday_postcard.html
  3. 4
      project/settings.py
  4. BIN
      web/src/img/birthday_postcard.jpg
  5. 2
      web/src/sass/_common.sass

@ -146,8 +146,17 @@ def send_gift_certificate(user_gift_certificate):
@app.task
def send_child_birthday_bonuses():
def send_child_birthday_email_and_bonuses():
for u in User.objects.exclude(child_first_name='', child_last_name='',).filter(child_birthday=now().date()):
if not UserBonus.objects.filter(user=u, is_service=True, action_name=UserBonus.ACTION_CHILD_BIRTHDAY).count():
print('user', u.email)
UserBonus.objects.create(user=u, amount=UserBonus.AMOUNT_CHILD_BIRTHDAY, is_service=True,
action_name=UserBonus.ACTION_CHILD_BIRTHDAY)
try:
fn = staticfiles_storage.path('img/birthday_postcard.jpg')
file = open(fn, 'rb')
send_email('С Днем Рождения!', u.email, 'notification/email/birthday_postcard.html',
attachments=[(file.name, file.read(), 'image/jpeg')],)
print('email has been sent')
finally:
file.close()

@ -0,0 +1,13 @@
{% extends "notification/email/_base.html" %}
{% block content %}
<p>
Поздравляем с Днём Рождения! Ваши подарочные лилики ждут вас.
</p>
<p>
Получите, распишитесь)
</p>
<p>
Ваша «Lil School».
</p>
{% endblock content %}

@ -262,8 +262,8 @@ CELERY_BEAT_SCHEDULE = {
'schedule': crontab(minute=0, hour=3),
'args': (),
},
'send_child_birthday_bonuses': {
'task': 'apps.notification.tasks.send_child_birthday_bonuses',
'send_child_birthday_email_and_bonuses': {
'task': 'apps.notification.tasks.send_child_birthday_email_and_bonuses',
'schedule': crontab(minute=0, hour=0),
'args': (),
},

Binary file not shown.

After

Width:  |  Height:  |  Size: 684 KiB

@ -2902,7 +2902,7 @@ a.grey-link
&_reply
padding-left: 80px
+m
padding: 10px 0
padding-left: 25px
&__reply-info
display: none
margin-bottom: 10px

Loading…
Cancel
Save