foerderbarometer/input/management/commands/sendmails.py

32 lines
935 B
Python
Raw Normal View History

from datetime import date
from django.core.management.base import BaseCommand, CommandError
# from django.db.models.query import QuerySet
from input.models import Project
class Command(BaseCommand):
''' mails will be send here:
- two weeks after confirmation of support for volunteer (/extern) send link
with surveylink
- same for HonoraryCertificate and accreditation (/intern)
- travel: mail 3 weeks after end of project.
- assumed end of project (/project) reached: mail to IF, link to project-editpage
'''
help = '''This command sends mail with some links to the database or to the survey
after some amount of time.'''
def handle(self, *args, **options):
# get all projects which ended 3 weeks ago
old = Project.objects.filter(end__lt = date.today())
print(old)
self.stdout.write(self.style.SUCCESS('sendmails custom command executed'))