|
|
|
|
@ -12,7 +12,7 @@ from django.conf import settings |
|
|
|
|
|
|
|
|
|
from apps.notification.models import UserNotification |
|
|
|
|
from apps.notification.utils import send_email |
|
|
|
|
from apps.payment.models import SchoolPayment, CoursePayment, Payment, UserGiftCertificate |
|
|
|
|
from apps.payment.models import SchoolPayment, CoursePayment, Payment, UserGiftCertificate, UserBonus |
|
|
|
|
from project.celery import app |
|
|
|
|
from project.utils.db import format_sql, execute_sql |
|
|
|
|
from project.sengrid import get_sendgrid_client |
|
|
|
|
@ -143,3 +143,11 @@ def send_gift_certificate(user_gift_certificate): |
|
|
|
|
send_email('Подарочный сертификат от Lil School', user_gift_certificate.user.email, 'notification/email/gift_certificate.html', |
|
|
|
|
inline_images=[('twitter_icon', 'img/twitter.png'), ('fb_icon', 'img/fb.png'), ('instagram_icon', 'img/instagram.png'),], |
|
|
|
|
user_gift_certificate=user_gift_certificate, gift_certificate=user_gift_certificate.gift_certificate) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@app.task |
|
|
|
|
def send_child_birthday_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(): |
|
|
|
|
UserBonus.objects.create(user=u, amount=UserBonus.AMOUNT_CHILD_BIRTHDAY, is_service=True, |
|
|
|
|
action_name=UserBonus.ACTION_CHILD_BIRTHDAY) |
|
|
|
|
|