first testmail

This commit is contained in:
Benni Baermann 2020-10-07 13:36:35 +02:00
parent cf50e1ef12
commit 2a33d5bb38
2 changed files with 12 additions and 5 deletions

View file

@ -12,6 +12,9 @@ https://docs.djangoproject.com/en/3.1/ref/settings/
from pathlib import Path from pathlib import Path
# mails in development go to stdout
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
# Build paths inside the project like this: BASE_DIR / 'subdir'. # Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent BASE_DIR = Path(__file__).resolve().parent.parent

View file

@ -2,6 +2,7 @@ from django.shortcuts import render
from django.forms import modelformset_factory from django.forms import modelformset_factory
from django.http import HttpResponse from django.http import HttpResponse
from formtools.wizard.views import CookieWizardView from formtools.wizard.views import CookieWizardView
from django.core.mail import send_mail
from .forms import ProjectForm, VolunteerForm, LibraryForm, IFGForm from .forms import ProjectForm, VolunteerForm, LibraryForm, IFGForm
from .models import Project from .models import Project
@ -56,10 +57,6 @@ class ExternView(CookieWizardView):
step = self.steps.current step = self.steps.current
print ("get_form() step " + step) print ("get_form() step " + step)
# prev_data = self.get_cleaned_data_for_step(self.get_prev_step(
# self.steps.current))
# print (data)
if step == '1': if step == '1':
prev_data = self.get_cleaned_data_for_step('0') prev_data = self.get_cleaned_data_for_step('0')
if prev_data.get('choice') == 'IFG': if prev_data.get('choice') == 'IFG':
@ -90,6 +87,13 @@ class ExternView(CookieWizardView):
# we need to send the following mails here: # we need to send the following mails here:
# - mail with entered data to the Volunteer # - mail with entered data to the Volunteer
send_mail(
'form filled',
'you are such a great form filler!',
'if-test@wikimedia.de',
['benni.baermann@wikimedia.de'],
fail_silently=False,
)
# - mail to IF with link to accept/decline # - mail to IF with link to accept/decline
return done(self.request) return done(self.request)