Commit 6d3d86bf authored by Daniel W Bond's avatar Daniel W Bond
Browse files

added a welcome email to students on completion of the welcome walkthrough

parent 538394f9
# standard library imports
from __future__ import absolute_import, print_function
from distutils.util import strtobool
from datetime import date
# core django imports
from django.shortcuts import redirect
from django.views.generic import FormView
......@@ -11,6 +12,7 @@ from braces.views import LoginRequiredMixin
from ratelimit.decorators import ratelimit
# imports from your apps
from accounts.models import Student, Confirmation, Major
from accounts.views import create_email
from housing.models import Room
from .forms import (WelcomeNameForm, WelcomeMajorForm,
WelcomePrivacyForm, WelcomeSocialForm)
......@@ -275,6 +277,25 @@ class WelcomeSocial(LoginRequiredMixin, FormView):
me.save()
# send students a welcome email
text_path = 'email/welcome.txt'
html_path = 'email/welcome.html'
today = date.today()
semester = "%s %s" % (get_semester(today), today.strftime('%Y'))
context = {
'student_name': me.get_first_name_or_uname,
'semester': semester
}
subject = "Welcome to Roomlist, %s" % me.get_first_name_or_uname()
to = me.user.email
welcome_email = create_email(text_path, html_path, subject, to, context)
welcome_email.send()
return super(WelcomeSocial, self).form_valid(form)
def get_success_url(self):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment