From 9e1d006070eda41708425becf5e8c9cbdb5c2053 Mon Sep 17 00:00:00 2001 From: hernani Date: Fri, 4 Jun 2010 11:45:59 +0000 Subject: [PATCH] Converts feedback message to new style. git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@373 0cfe37f9-358a-4d5e-be75-b63607b5c754 --- .../default/templates/notifications/base.html | 2 +- .../templates/notifications/feedback.html | 72 ++++++++++++------- .../templates/notifications/newmember.html | 2 +- forum/views/meta.py | 8 +-- 4 files changed, 50 insertions(+), 34 deletions(-) diff --git a/forum/skins/default/templates/notifications/base.html b/forum/skins/default/templates/notifications/base.html index 9d09f59..404f3d8 100644 --- a/forum/skins/default/templates/notifications/base.html +++ b/forum/skins/default/templates/notifications/base.html @@ -14,7 +14,7 @@
-{{settings.APP_TITLE}} +{{settings.APP_TITLE}}
{% if not exclude_greeting %}

{% trans "Hello" %} {{ recipient.username }},

diff --git a/forum/skins/default/templates/notifications/feedback.html b/forum/skins/default/templates/notifications/feedback.html index b9464f2..ec4d211 100644 --- a/forum/skins/default/templates/notifications/feedback.html +++ b/forum/skins/default/templates/notifications/feedback.html @@ -1,29 +1,47 @@ -{% extends "email_base.html" %} -{% load i18n %} -{% load extra_tags %} -{% load email_tags %} - -{% block content %} -

{% spaceless %} - {% blocktrans with settings.APP_SHORT_NAME as site_title %} - Hello, this is a {{site_title}} forum feedback message - {% endblocktrans %} - {% endspaceless %}

- -

- {% trans "Sender" %}: - {% if user.is_authenticated %} - {{ user.username }}
{% trans "email" %}:{{ user.email }} - {% else %} - {% if name %}{{ name }}{% else %}{% trans "anonymous" %}{% endif %} - {% if email %}{% trans "email" %}:{{ email }}{% endif %} - {% endif %} -
- ip: {{ ip }} -

- -
+{% load i18n extra_tags email_tags %} + +{% declare %} + prefix = settings.EMAIL_SUBJECT_PREFIX + app_name = settings.APP_SHORT_NAME + + exclude_greeting = True + exclude_finetune = True +{% enddeclare %} + +{% email %} + {% subject %}{% blocktrans %}{{ prefix }} Feedback message from {{ app_name }}{% endblocktrans %}{% endsubject %} + + {% htmlcontent notifications/base.html %} +

+ {% trans "Sender" %}: + {% if user.is_authenticated %} + {{ user.username }}
{% trans "email" %}:{{ user.email }} + {% else %} + {% if name %}{{ name }}{% else %}{% trans "anonymous" %}{% endif %} + {% if email %}{% trans "email" %}:{{ email }}{% endif %} + {% endif %} +
+ ip: {{ ip }} +

+ +
{% trans "Message body:" %} {{ message }} -
+
+ + {% endhtmlcontent %} + +{% textcontent notifications/base_text.html %} +{% if user.is_authenticated %} +{% trans "Sender" %}: {{ user.username }} +{% trans "email" %}: {{ user.email }} +{% else %} +{% trans "Sender" %}: {% if name %}{{ name }}{% else %}{% trans "anonymous" %}{% endif %} +{% if email %}{% trans "email" %}: {{ email }}{% endif %} +{% endif %} +ip: {{ ip }} + +{% trans "Message body:" %} {{ message }} +{% endtextcontent %} + +{% endemail %} -{% endblock %} diff --git a/forum/skins/default/templates/notifications/newmember.html b/forum/skins/default/templates/notifications/newmember.html index e189e3d..1c385b3 100644 --- a/forum/skins/default/templates/notifications/newmember.html +++ b/forum/skins/default/templates/notifications/newmember.html @@ -23,7 +23,7 @@ {% textcontent notifications/base_text.html %} {% blocktrans %} -{{ newmember_name }} has just joined {{ app_name }}. You can visit {{ newmember_name }}'s profile using the following url:
+{{ newmember_name }} has just joined {{ app_name }}. You can visit {{ newmember_name }}'s profile using the following url: {{ app_url }}{{ newmember_url }} {% endblocktrans %} {% endtextcontent %} diff --git a/forum/views/meta.py b/forum/views/meta.py index bae96f2..c0da3a2 100644 --- a/forum/views/meta.py +++ b/forum/views/meta.py @@ -14,7 +14,7 @@ from forum.utils.forms import get_next_url from forum.models import Badge, Award, User from forum.badges.base import BadgesMeta from forum import settings -from forum.utils.mail import send_email +from forum.utils.mail import send_template_email import re def favicon(request): @@ -50,10 +50,8 @@ def feedback(request): context['name'] = form.cleaned_data.get('name',None) context['ip'] = request.META['REMOTE_ADDR'] - recipients = [(adm.username, adm.email) for adm in User.objects.filter(is_superuser=True)] - - send_email(settings.EMAIL_SUBJECT_PREFIX + _("Feedback message from %(site_name)s") % {'site_name': settings.APP_SHORT_NAME}, - recipients, "notifications/feedback.html", context) + recipients = User.objects.filter(is_superuser=True) + send_template_email(recipients, "notifications/feedback.html", context) msg = _('Thanks for the feedback!') request.user.message_set.create(message=msg) -- 2.39.5