From afa0f6b55ab558ac30bc07f1f87bf51ca1e562cf Mon Sep 17 00:00:00 2001 From: Benni Baermann Date: Tue, 27 Oct 2020 13:08:47 +0100 Subject: [PATCH] added IFG to sendmails command --- input/management/commands/sendmails.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/input/management/commands/sendmails.py b/input/management/commands/sendmails.py index 9987088..1086e93 100644 --- a/input/management/commands/sendmails.py +++ b/input/management/commands/sendmails.py @@ -5,7 +5,8 @@ from django.core.management.base import BaseCommand, CommandError from django.template.loader import get_template from django.core.mail import send_mail, BadHeaderError -from input.models import Project, Library, HonoraryCertificate, Travel, Email, BusinessCard, List +from input.models import Project, Library, HonoraryCertificate, Travel, Email,\ + BusinessCard, List, IFG from input.settings import URLPREFIX, IF_EMAIL, SURVEYPREFIX class Command(BaseCommand): @@ -103,6 +104,14 @@ class Command(BaseCommand): .exclude(survey_mail_send=True) self.surveymails_to_object(supported, type='HON', name='request_url') + def surveymails_to_ifg(self): + '''get all IFG objects which where granted two weeks ago''' + + supported = IFG.objects.filter(granted=True)\ + .filter(granted_date__lt = date.today() - timedelta(days=14))\ + .exclude(survey_mail_send=True) + self.surveymails_to_object(supported, type='IFG', name='url') + def surveymails_to_project(self): '''send survey link 4 weeks after end of project reached''' supported = Project.objects.filter(granted=True)\ @@ -139,6 +148,7 @@ class Command(BaseCommand): self.end_of_projects_reached() self.surveymails_to_lib() self.surveymails_to_hon() + self.surveymails_to_ifg() self.surveymails_to_project() self.surveymails_to_travel() self.surveymails_to_mail_vis_lis()