|
@ -63,7 +63,7 @@ class Command(BaseCommand): |
|
|
send_mail('Projektende erreicht', |
|
|
send_mail('Projektende erreicht', |
|
|
mail_template.render(context), |
|
|
mail_template.render(context), |
|
|
IF_EMAIL, |
|
|
IF_EMAIL, |
|
|
[IF_EMAIL], |
|
|
|
|
|
|
|
|
['luca@cannabinieri.de'], |
|
|
fail_silently=False) |
|
|
fail_silently=False) |
|
|
project.end_mail_send = True |
|
|
project.end_mail_send = True |
|
|
project.save() |
|
|
project.save() |
|
@ -79,7 +79,10 @@ class Command(BaseCommand): |
|
|
approved_end = Project.objects.filter(status = 'END')\ |
|
|
approved_end = Project.objects.filter(status = 'END')\ |
|
|
.exclude(end_mail_send = False) |
|
|
.exclude(end_mail_send = False) |
|
|
print(approved_end) |
|
|
print(approved_end) |
|
|
mail_template = get_template('input/if_end_of_project.txt') |
|
|
|
|
|
|
|
|
mail_template = get_template('input/if_end_of_project_approved.txt') |
|
|
|
|
|
informMail_template = get_template('input/if_end_of_project_orginformed.txt') |
|
|
|
|
|
# send the mail to project.email, which would be the mail of the volunteer filling out the form |
|
|
|
|
|
|
|
|
for project in approved_end: |
|
|
for project in approved_end: |
|
|
context = {'project': project} |
|
|
context = {'project': project} |
|
|
context['URLPREFIX'] = settings.URLPREFIX |
|
|
context['URLPREFIX'] = settings.URLPREFIX |
|
@ -87,14 +90,54 @@ class Command(BaseCommand): |
|
|
send_mail('Projektende erreicht', |
|
|
send_mail('Projektende erreicht', |
|
|
mail_template.render(context), |
|
|
mail_template.render(context), |
|
|
IF_EMAIL, |
|
|
IF_EMAIL, |
|
|
|
|
|
[project.email], |
|
|
|
|
|
fail_silently=False) |
|
|
|
|
|
send_mail('Projektorganisator*in wurde informiert', |
|
|
|
|
|
informMail_template.render(context), |
|
|
|
|
|
IF_EMAIL, |
|
|
[IF_EMAIL], |
|
|
[IF_EMAIL], |
|
|
fail_silently=False) |
|
|
fail_silently=False) |
|
|
|
|
|
|
|
|
project.end_mail_send = True |
|
|
project.end_mail_send = True |
|
|
project.save() |
|
|
project.save() |
|
|
except BadHeaderError: |
|
|
except BadHeaderError: |
|
|
self.stdout.write(self.style.ERROR('Invalid header found.')) |
|
|
self.stdout.write(self.style.ERROR('Invalid header found.')) |
|
|
|
|
|
|
|
|
self.stdout.write(self.style.SUCCESS('end_of_projects_reached() executed.')) |
|
|
|
|
|
|
|
|
self.stdout.write(self.style.SUCCESS('end_of_projects_approved() executed.')) |
|
|
|
|
|
|
|
|
|
|
|
def notHappened_of_projects_approved(self): |
|
|
|
|
|
''' notHappened of project approved ''' |
|
|
|
|
|
# get all projects where end was reached already, and send mails for the ones where status was put to NOT by admins |
|
|
|
|
|
|
|
|
|
|
|
approved_notHappened = Project.objects.filter(status = 'NOT')\ |
|
|
|
|
|
.exclude(end_mail_send = False) |
|
|
|
|
|
|
|
|
|
|
|
mail_template = get_template('input/if_not_of_project_approved.txt') |
|
|
|
|
|
informMail_template = get_template('input/if_end_of_project_orginformed.txt') |
|
|
|
|
|
|
|
|
|
|
|
# send the mail to project.email, which would be the mail of the volunteer that filled out the form |
|
|
|
|
|
|
|
|
|
|
|
for project in approved_notHappened: |
|
|
|
|
|
context = {'project': project} |
|
|
|
|
|
context['URLPREFIX'] = settings.URLPREFIX |
|
|
|
|
|
try: |
|
|
|
|
|
send_mail('Projektende erreicht', |
|
|
|
|
|
mail_template.render(context), |
|
|
|
|
|
IF_EMAIL, |
|
|
|
|
|
[project.email], |
|
|
|
|
|
fail_silently=False) |
|
|
|
|
|
send_mail('Projektorganisator*in wurde informiert', |
|
|
|
|
|
informMail_template.render(context), |
|
|
|
|
|
IF_EMAIL, |
|
|
|
|
|
[IF_EMAIL], |
|
|
|
|
|
fail_silently=False) |
|
|
|
|
|
|
|
|
|
|
|
project.end_mail_send = True |
|
|
|
|
|
project.save() |
|
|
|
|
|
except BadHeaderError: |
|
|
|
|
|
self.stdout.write(self.style.ERROR('Invalid header found.')) |
|
|
|
|
|
|
|
|
|
|
|
self.stdout.write(self.style.SUCCESS('notHappened_of_projects_approved() executed.')) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def surveymails_to_object(self, supported, name='', type='LIB'): |
|
|
def surveymails_to_object(self, supported, name='', type='LIB'): |
|
@ -186,6 +229,7 @@ class Command(BaseCommand): |
|
|
|
|
|
|
|
|
self.end_of_projects_reached() |
|
|
self.end_of_projects_reached() |
|
|
self.end_of_projects_approved() |
|
|
self.end_of_projects_approved() |
|
|
|
|
|
self.notHappened_of_projects_approved() |
|
|
self.surveymails_to_lib() |
|
|
self.surveymails_to_lib() |
|
|
self.surveymails_to_hon() |
|
|
self.surveymails_to_hon() |
|
|
self.surveymails_to_ifg() |
|
|
self.surveymails_to_ifg() |
|
|