|
@ -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')) |