tasks.py 文件源码

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

项目:api-django 作者: lafranceinsoumise 项目源码 文件源码
def send_cancellation_notification(event_pk):
    try:
        event = Event.objects.get(pk=event_pk)
    except Event.DoesNotExist:
        return

    # check it is indeed cancelled
    if event.published:
        return

    event_name = event.name

    notifications_enabled = Q(notifications_enabled=True) & Q(person__event_notifications=True)

    recipients = [rsvp.person for rsvp in event.rsvps.filter(notifications_enabled).prefetch_related('person__emails')]

    bindings = {
        "EVENT_NAME": event_name
    }

    send_mosaico_email(
        code='EVENT_CANCELLATION',
        subject=_("Un événement auquel vous participiez a été annulé"),
        from_email=settings.EMAIL_FROM,
        recipients=recipients,
        bindings=bindings
    )
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号