From 2a33d5bb389c21fd3d8551c51a485277972f0931 Mon Sep 17 00:00:00 2001 From: Benni Baermann Date: Wed, 7 Oct 2020 13:36:35 +0200 Subject: [PATCH] first testmail --- foerderbarometer/settings.py | 3 +++ input/views.py | 14 +++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/foerderbarometer/settings.py b/foerderbarometer/settings.py index abea68d..4f7a3b9 100644 --- a/foerderbarometer/settings.py +++ b/foerderbarometer/settings.py @@ -12,6 +12,9 @@ https://docs.djangoproject.com/en/3.1/ref/settings/ 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'. BASE_DIR = Path(__file__).resolve().parent.parent diff --git a/input/views.py b/input/views.py index 41ff8a8..2da11cf 100644 --- a/input/views.py +++ b/input/views.py @@ -2,6 +2,7 @@ from django.shortcuts import render from django.forms import modelformset_factory from django.http import HttpResponse from formtools.wizard.views import CookieWizardView +from django.core.mail import send_mail from .forms import ProjectForm, VolunteerForm, LibraryForm, IFGForm from .models import Project @@ -56,10 +57,6 @@ class ExternView(CookieWizardView): step = self.steps.current 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': prev_data = self.get_cleaned_data_for_step('0') if prev_data.get('choice') == 'IFG': @@ -90,7 +87,14 @@ class ExternView(CookieWizardView): # we need to send the following mails here: # - mail with entered data to the Volunteer - # - mail to IF with link to accept/decline + 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 return done(self.request) # return render(self.request, 'saved', {