From 3b07ef43168eefcb3a0be3510d24c561101bf006 Mon Sep 17 00:00:00 2001 From: Francesco Siddi Date: Mon, 21 Jul 2014 20:39:09 +0200 Subject: [PATCH] General tweaks to email notifications --- blender-bfct/application/emails.py | 6 +++++- .../application/templates/applications/view.html | 7 ++++++- .../application/templates/email/new_submission.html | 13 +++++++++++-- .../application/templates/email/new_submission.txt | 9 ++++++++- 4 files changed, 30 insertions(+), 5 deletions(-) diff --git a/blender-bfct/application/emails.py b/blender-bfct/application/emails.py index 39bef94..cbf73c8 100644 --- a/blender-bfct/application/emails.py +++ b/blender-bfct/application/emails.py @@ -25,7 +25,11 @@ def send_email(subject, sender, recipients, text_body, html_body): def send_email_notification_new_submission(application): board_members = get_board_members_emails() - send_email("[BFCT] New BFCT application submitted", + if application.user.first_name: + applicant = application.user.first_name + " " + application.user.last_name + else: + applicant = application.user.email + send_email("[BFCT] " + applicant + " applied for BFCT", 'bfct-robot@blender.org', board_members, render_template("email/new_submission.txt", diff --git a/blender-bfct/application/templates/applications/view.html b/blender-bfct/application/templates/applications/view.html index 0e7d4c6..949f7c4 100755 --- a/blender-bfct/application/templates/applications/view.html +++ b/blender-bfct/application/templates/applications/view.html @@ -3,7 +3,12 @@ {% block body %}
-

{{application.user.first_name}} {{application.user.last_name}}

+ {% if application.user.first_name %} +

{{application.user.first_name}} {{application.user.last_name}}

+ {% else %} +

{{application.user.email}}

+ {% endif %} +

{{application.city_country}}

{{application.bio_message|safe}}

diff --git a/blender-bfct/application/templates/email/new_submission.html b/blender-bfct/application/templates/email/new_submission.html index 99d292b..595dc09 100644 --- a/blender-bfct/application/templates/email/new_submission.html +++ b/blender-bfct/application/templates/email/new_submission.html @@ -1,4 +1,13 @@ -

Hello there fellow BFCT member!

-

A new BFCT application awaits your review! Check it out at the BFCT portal.

+

Hello there fellow BFCT board member!

+ +

+ {% if application.user.first_name %} + {{application.user.first_name }} {{ application.user.last_name }} + {% else %} + {{application.user.email}} + {% endif %} + just applied for BFCT! +

+

Check out her/his submission at the BFCT portal.

The BFCT robot

diff --git a/blender-bfct/application/templates/email/new_submission.txt b/blender-bfct/application/templates/email/new_submission.txt index 60e744a..e66c33b 100644 --- a/blender-bfct/application/templates/email/new_submission.txt +++ b/blender-bfct/application/templates/email/new_submission.txt @@ -1,4 +1,11 @@ Hello there fellow board member! -A new BFCT application awaits your review! Check it out at http://www.blender.org/certification{{url_for('applications.view', id=application.id)}}. + +{% if application.user.first_name %} +{{application.user.first_name }} {{ application.user.last_name }} just applied for BFCT! +{% else %} +{{application.user.email}} just applied for BFCT! +{% endif %} + +Check out her/his submission at http://www.blender.org/{{url_for('applications.view', id=application.id)}}. The BFCT robot