kadenios/elections/tasks.py

13 lines
351 B
Python

from celery import shared_task
from .models import Election
from .utils import send_mail
@shared_task
def send_election_mail(election_pk, subject, body, reply_to):
election = Election.objects.get(pk=election_pk)
send_mail(election, subject, body, reply_to)
election.sent_mail = False
election.save()
# election.sent_mail = True