Add Member application emails
This commit is contained in:
@@ -6,5 +6,6 @@
|
||||
{% block content %}
|
||||
<link rel="stylesheet" href="{% static "css/application.css" %}">
|
||||
<h3>{% trans "Hienoa! Jäsenhakemuksesi on nyt lähetetty." %}</h3>
|
||||
<p>{% trans "Vahvistusviesti on lähetetty sähköpostiisi. Ota yhteyttä sik-vtmk@list.ayy.fi jos viestiä ei näy." %}</p>
|
||||
<a href="/"><h4>{% trans "Takaisin Sähköinsinöörikillan web-sivuille" %}</h4></a>
|
||||
{% endblock content %}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
{% load i18n %}
|
||||
{% trans "Moi" %} {{ first_name }}!
|
||||
|
||||
{% trans "Onnittelut! Sinut on hyväksytty Sähköinsinöörikillan jäseneksi." %}
|
||||
|
||||
{% trans "Käy kurkkaamassa killan nettisivuilta" %} (https://sik.ayy.fi) {% trans "tulevia tapahtumia ja piipahda kiltahuoneella tutustumassa uusiin kiltatovereihisi!" %}
|
||||
|
||||
{% trans "Liity myös killan TG-kanaville" %}:
|
||||
{% trans "SIK" %}: https://t.me/joinchat/A6EViD5FCWLxPcXCggY7hw
|
||||
{% trans "SIK-fuksit 2019" %}: http://tinyurl.com/sikfuksit19-tg
|
||||
{% trans "SIK-fuksit 2019 -tiedotuskanava" %}: http://tinyurl.com/sikfuksit19-tiedotus
|
||||
@@ -0,0 +1,21 @@
|
||||
{% load i18n %}
|
||||
{% trans "Moikka" %} {{ application.first_name }},
|
||||
|
||||
{% trans "Sait tämän viestin, sillä olet lähettänyt hakemuksen Aalto-yliopiston Sähköinsinöörikillan jäseneksi alla olevin tiedoin. Siistiä!" %}
|
||||
|
||||
{% trans "Etunimi" %}: {{ application.first_name }}
|
||||
{% trans "Sukunimi" %}: {{ application.last_name }}
|
||||
{% trans "Sähköposti" %}: {{ application.email }}
|
||||
{% trans "Kotipaikkakunta" %}: {{ application.POR }}
|
||||
{% trans "AYY:n jäsen" %}: {{ ayy }}
|
||||
{% trans "Haluan jäsenmailin" %}: {{ jas }}
|
||||
|
||||
{% trans "Saat sähköpostiisi tiedon, kun sinut on hallituksen kokouksessa hyväksytty jäseneksi" %}.
|
||||
|
||||
{% trans "Muistathan maksaa jäsenmaksun! Alla maksutiedot" %}:
|
||||
|
||||
{% trans "Saaja" %}: Aalto-yliopiston Sähköinsinöörikilta ry
|
||||
{% trans "Tilinumero" %}: FI97 1309 3000 1118 23
|
||||
BIC: NDEAFIHH
|
||||
{% trans "Viite" %}: 1313
|
||||
{% trans "Summa" %}: 8 €
|
||||
@@ -7,10 +7,13 @@ from django.core.mail import send_mail
|
||||
from django.conf import settings
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.forms.models import model_to_dict
|
||||
from django.template.loader import render_to_string
|
||||
|
||||
import logging
|
||||
import html
|
||||
|
||||
from webapp.utils import send_email
|
||||
|
||||
from members.views.utils import *
|
||||
from members.tables import RequestTable
|
||||
from members.forms import ApplicationForm
|
||||
@@ -90,6 +93,16 @@ def application_accept(request, *args, **kwargs):
|
||||
.format(form))
|
||||
notification = "{} {}.".format(_("Successfully accepted application"),
|
||||
str(application))
|
||||
|
||||
subject = _('Jäsenhakemuksesi Sähköinsinöörikiltaan on hyväksytty!')
|
||||
|
||||
message = render_to_string(
|
||||
'members:email_application_accept.html', {
|
||||
'first_name': application.first_name
|
||||
}
|
||||
)
|
||||
send_email(member.email, subject, message)
|
||||
|
||||
return HttpResponseRedirect(
|
||||
'/members/list?notification={}'.format(html.escape(notification)))
|
||||
except Exception as ex:
|
||||
@@ -157,6 +170,21 @@ def application_submit(request, *args, **kwargs):
|
||||
form = ApplicationForm(request.POST)
|
||||
if form.is_valid():
|
||||
form.save()
|
||||
return render(request, 'application_success.html', {})
|
||||
try:
|
||||
application = form.instance
|
||||
email = form.cleaned_data.get('email', '')
|
||||
|
||||
subject = _('Jäsenhakemuksesi Sähköinsinöörikiltaan on lähetetty onnistuneesti!')
|
||||
|
||||
message = render_to_string(
|
||||
'members:email_application_submit.html', {
|
||||
'application': application,
|
||||
'ayy': _('Kyllä') if application.AYY else _('Ei'),
|
||||
'jas': _('Kyllä') if application.jas else _('Ei')
|
||||
}
|
||||
)
|
||||
send_email(email, subject, message)
|
||||
finally:
|
||||
return render(request, 'application_success.html', {})
|
||||
else:
|
||||
return error_view(request, form.errors)
|
||||
|
||||
Reference in New Issue
Block a user