kadenios/elections/tasks.py

14 lines
331 B
Python
Raw Normal View History

2021-06-19 21:06:22 +02:00
from celery import shared_task
from .models import Election
from .utils import send_mail
@shared_task
def send_election_mail(election_pk, subject, body):
election = Election.objects.get(pk=election_pk)
send_mail(election, subject, body)
election.sent_mail = False
election.save()
# election.sent_mail = True