Skip to content
Snippets Groups Projects
Commit f8de697c authored by Julian's avatar Julian
Browse files

fic notification template errors

parent aa133bc6
No related branches found
No related tags found
1 merge request!117Resolve "Use or create external library for template mailer"
Pipeline #621 failed
......@@ -212,15 +212,19 @@ class Notification(models.Model):
return self.title
def save(self, **kwargs):
super().save(**kwargs)
if not self.mailed:
context = self.__dict__
context["notification_user"] = " ".join([self.user.first_name, self.user.last_name])
send_templated_mail(
template_name='notification',
from_email=config.MAIL_OUT,
recipient_list=[self.user.email],
context={"notification": self}
context=context,
)
self.mailed = True
super().save(**kwargs)
super().save(**kwargs)
class Meta:
verbose_name = _("Notification")
......
{% load i18n %}
{% block subject %} My subject for {{username}} {% endblock %}
{% block subject %} {% trans "New notification for" %} {{ notification_user }} {% endblock %}
{% block html %}
<main>
{% blocktrans %}
<h1>Dear {{ username }},</h1>
<p>thank you for using <em>AlekSIS</em>!</p>
<p>Yours sincerely
<br>
AlekSIS team</p>
<p>Dear {{ notification.user.get_full_name }}, <br>
weǜe got a new message for you:</p>
<h1>{{ notification }}</h1>
<p>Dear {{ notification_user }}, <br>
we got a new message for you:</p>
{% endblocktrans %}
<blockquote>
<p>{{ notification.description }}</p>
{% if notification.link %}
<a href="{{ notification.link }}">More information →</a>
<p>{{ description }}</p>
{% if link %}
<a href="{{ link }}">{% trans "More information" %} →</a>
{% endif %}
</blockquote>
<p>By {{ notification.app }} at {{ notification.created_at }}</p>
{% blocktrans %}
<p>By {{ app }} at {{ created_at }}</p>
<i>Your AlekSIS team</i>
{% endblocktrans %}
......
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