preliminary work for the sendmails command

This commit is contained in:
Benni Bärmann 2020-10-21 15:01:05 +02:00
parent a78c10c043
commit 541b9d8f7e
1 changed files with 24 additions and 13 deletions

View File

@ -1,20 +1,31 @@
from django.core.management.base import BaseCommand, CommandError
from datetime import date
from django.core.management.base import BaseCommand, CommandError
# from django.db.models.query import QuerySet
from input.models import Project
# mails must 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
#
class Command(BaseCommand):
help = 'This command sends mail with surveylinks after some amount of time.'
''' 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'))