From 541b9d8f7ea439ee416a172fcd9db2f043e2e726 Mon Sep 17 00:00:00 2001 From: Benni Baermann Date: Wed, 21 Oct 2020 15:01:05 +0200 Subject: [PATCH] preliminary work for the sendmails command --- input/management/commands/sendmails.py | 35 +++++++++++++++++--------- 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/input/management/commands/sendmails.py b/input/management/commands/sendmails.py index 287cab6..3645b60 100644 --- a/input/management/commands/sendmails.py +++ b/input/management/commands/sendmails.py @@ -1,20 +1,31 @@ +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'))