Browse Source

preliminary work for the sendmails command

master
Benni Baermann 4 years ago
parent
commit
541b9d8f7e
1 changed files with 23 additions and 12 deletions
  1. +23
    -12
      input/management/commands/sendmails.py

+ 23
- 12
input/management/commands/sendmails.py View File

@ -1,20 +1,31 @@
from datetime import date
from django.core.management.base import BaseCommand, CommandError 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): 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): 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')) self.stdout.write(self.style.SUCCESS('sendmails custom command executed'))

Loading…
Cancel
Save