Render scheduled task response as html to improve readability in email

This commit is contained in:
Debanjum Singh Solanky 2024-04-27 01:05:29 +05:30
parent c17dbbeb92
commit 3ce06a938c
2 changed files with 4 additions and 1 deletions

View file

@ -76,6 +76,7 @@ dependencies = [
"django-phonenumber-field == 7.3.0",
"phonenumbers == 8.13.27",
"markdownify ~= 0.11.6",
"markdown-it-py ~= 3.0.0",
"websockets == 12.0",
"psutil >= 5.8.0",
"huggingface-hub >= 0.22.2",

View file

@ -6,6 +6,7 @@ try:
except ImportError:
pass
import markdown_it
from django.conf import settings
from jinja2 import Environment, FileSystemLoader
@ -56,7 +57,8 @@ def send_task_email(name, email, query, result):
template = env.get_template("task.html")
html_content = template.render(name=name, query=query, result=result)
html_result = markdown_it.MarkdownIt().render(result)
html_content = template.render(name=name, query=query, result=html_result)
resend.Emails.send(
{