Fixing syntax errors
This commit is contained in:
parent
258048654d
commit
d14c5af70d
1 changed files with 4 additions and 2 deletions
|
@ -13,7 +13,9 @@ class MailView(ContextMixin):
|
||||||
self.html_template_name = html_template_name
|
self.html_template_name = html_template_name
|
||||||
self.text_template_name = text_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")):
|
if len(template_name.split("/")[-1].split(".")[-1] in ("html", "txt")):
|
||||||
basename = template_name.rsplit(".", 1)[0]
|
basename = template_name.rsplit(".", 1)[0]
|
||||||
else:
|
else:
|
||||||
|
@ -42,7 +44,7 @@ class MailView(ContextMixin):
|
||||||
context = self.get_context_data(**kwargs)
|
context = self.get_context_data(**kwargs)
|
||||||
return render_to_string(self.text_template_name, context)
|
return render_to_string(self.text_template_name, context)
|
||||||
else:
|
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 BeautifulSoup(html).get_text()
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
Loading…
Reference in a new issue