Unverified Commit c82a4b15 authored by Thom Wiggers's avatar Thom Wiggers 📐

Render email as template

This is broken since we don't have access to member yet in that place....
parent 03e9ec2a
......@@ -2,6 +2,8 @@ from __future__ import unicode_literals
from django import forms
from django.contrib.auth.models import User
from django.template import loader
from django.utils import translation
from django.utils.translation import ugettext_lazy as _
from .models import Member
......@@ -40,7 +42,10 @@ class UserCreationForm(forms.ModelForm):
if commit:
user.save()
if self.cleaned_data['send_welcome_email']:
email_body = "new password: {}".format(password)
with translation.override(user.member.language):
email_body = loader.render_to_string(
'members/email/welcome.html',
{'user': user, 'password': password})
user.email_user(
_('Welkom bij Studievereniging Thalia'),
email_body)
......
{% load i18n %}
{% begin blocktrans %}Dear {{ user.get_full_name }},
Welcome to Study Association Thalia! You now have an account and can
log in at https://thalia.nu/. Make sure to check the information in
your profile.
Your username is: {{ user.username }}
Your password is: {{ password }}
Please also check the following information, if relevant:
Student number: {{ user.member.student_number }}
Cheers,
Thalia
{% endblocktrans %}
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