diff --git a/mail/views.py b/mail/views.py index ff20f42..53d507a 100644 --- a/mail/views.py +++ b/mail/views.py @@ -13,7 +13,9 @@ class MailView(ContextMixin): self.html_template_name = html_template_name self.text_template_name = text_template_name - if self._template_name := template_name: + if template_name: + self._template_name = template_name + if len(template_name.split("/")[-1].split(".")[-1] in ("html", "txt")): basename = template_name.rsplit(".", 1)[0] else: @@ -42,7 +44,7 @@ class MailView(ContextMixin): context = self.get_context_data(**kwargs) return render_to_string(self.text_template_name, context) else: - if from_html and html := self.render_to_html(**kwargs): + if from_html and (html := self.render_to_html(**kwargs)): return BeautifulSoup(html).get_text() return None