tasks.py 文件源码

python
阅读 29 收藏 0 点赞 0 评论 0

项目:vishleva.com 作者: webmalc 项目源码 文件源码
def event_notifications_task():
    events = Event.objects.get_for_notification()
    for event in events:
        Mailer.mail_managers(
            subject='Upcoming event' + ' - ' + event.title,
            template='emails/upcoming_event_manager.html',
            data={'event': event})
        client = event.client
        if client.email:
            Mailer.mail_user(
                subject='??????????? ? ??????????? ??????????',
                template='emails/upcoming_event_client.html',
                data={'event': event},
                email=client.email)
        if client.phone:
            sender = Sender()
            begin = arrow.get(event.begin).to(settings.TIME_ZONE).datetime
            sender.send_sms(
                'Zdravstvuyte. Napominaju Vam, chto u Vas {} zaplanirovana fotosessija. Aleksandra Vishleva +7(903)735-60-96'.
                format(begin.strftime('%d.%m.%Y %H:%M')),
                client=client,
                send_before=begin - timedelta(hours=6))

        event.notified_at = timezone.now()
        event.save()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号