kadenios/elections/tasks.py

13 lines
318 B
Python
Raw Permalink 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
2021-06-20 09:00:28 +02:00
def send_election_mail(election_pk, subject, body, reply_to):
2021-06-19 21:06:22 +02:00
election = Election.objects.get(pk=election_pk)
2021-06-20 09:00:28 +02:00
send_mail(election, subject, body, reply_to)
2021-06-20 12:53:55 +02:00
election.sent_mail = True
2021-06-19 21:06:22 +02:00
election.save()