added IFG to sendmails command

This commit is contained in:
Benni Bärmann 2020-10-27 13:08:47 +01:00
parent 34936c7ef2
commit afa0f6b55a
1 changed files with 11 additions and 1 deletions

View File

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