🐛(backend) format html when generate document

When we converted from markdown to html,
we didn't format the html, so it was displayed
like a string in our pdf.
We now format_html the html before we generate
the pdf.
This commit is contained in:
Anthony LC
2024-04-10 14:49:48 +02:00
committed by Anthony LC
parent 2665b707db
commit cc64b8c8b5

View File

@@ -11,6 +11,7 @@ from django.core import mail, validators
from django.db import models
from django.template.base import Template as DjangoTemplate
from django.template.context import Context
from django.utils.html import format_html
from django.utils.functional import lazy
from django.utils.translation import gettext_lazy as _
@@ -191,7 +192,7 @@ class Template(BaseModel):
document_html = HTML(
string=DjangoTemplate(self.code).render(
Context({"body": body_html, **metadata})
Context({"body": format_html(body_html), **metadata})
)
)
css = CSS(