Skip to content
Snippets Groups Projects
Commit 484bf226 authored by Hangzhi Yu's avatar Hangzhi Yu
Browse files

Use send_templated_mail, therefore adding new hjelp email template and making...

Use send_templated_mail, therefore adding new hjelp email template and making according changes in views
parent 0d871b4e
No related branches found
No related tags found
1 merge request!11Resolve "Replace send_mail_with_template"
{% load i18n %}
{% block subject %} {% trans "New" %} {{ type }} {% trans "from" %} {{ user.username }} {% endblock %}
{% block html %}
<main>
<p>{% trans "The user" %} {{ user.username }} ({% trans "full name: "} {{ user.first_name }} {{ user.last_name }}, {% trans "e-mail: "} {{ user.email }}) {% trans "has submitted the following" %} {{ type }}: </p>
<blockquote>
{{ for item in description }}
<p>{{ item }}</p>
{{ endfor }}
</blockquote>
</main>
{% endblock %}
......@@ -6,9 +6,7 @@ from .models import FAQSection, FAQQuestion, IssueCategory
from .forms import FAQForm, IssueForm, FeedbackForm
from constance import config
from .mailer import send_mail_with_template
from templated_email import send_templated_mail
from aleksis.apps.chronos.models import Room
from aleksis.core.models import Activity
......@@ -40,14 +38,12 @@ def ask_faq(request):
)
act.save()
context = {"question": question, "user": request.user}
send_mail_with_template(
f"[FAQ QUESTION] {question}",
[config.MAIL_QUESTIONS],
"hjelp/mail/question.txt",
"hjelp/mail/question.html",
context,
f"{request.user.get_full_name()} <{request.user.email}>",
context = {"description": [question], "user": request.user, "type": _("FAQ question")}
send_templated_mail(
template_name="hjelp",
from_email=f"{request.user.get_full_name()} <{request.user.email}>",
recipient_list=[config.MAIL_QUESTIONS],
context=context,
)
return render(request, "hjelp/question_submitted.html")
......@@ -105,25 +101,25 @@ def rebus(request):
# Send mail
context = {
"arrow_list": add_arrows(
[
bug_category_1,
bug_category_2,
bug_category_3,
bug_category_free_text,
]
),
"short_desc": short_description,
"long_desc": long_description,
"description": [add_arrows(
[
bug_category_1,
bug_category_2,
bug_category_3,
bug_category_free_text,
]
),
short_description,
long_description,
],
"user": request.user,
"type": _("Issue"),
}
send_mail_with_template(
f"[Issue] {short_description}",
[config.MAIL_Issue],
"hjelp/mail/rebus.txt",
"hjelp/mail/rebus.html",
context,
f"{request.user.get_full_name()} <{request.user.email}>",
send_templated_mail(
template_name="hjelp",
from_email=f"{request.user.get_full_name()} <{request.user.email}>",
recipient_list=[config.MAIL_QUESTIONS],
context=context,
)
return render(request, "hjelp/rebus_submitted.html")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment