🐛(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:
@@ -11,6 +11,7 @@ from django.core import mail, validators
|
|||||||
from django.db import models
|
from django.db import models
|
||||||
from django.template.base import Template as DjangoTemplate
|
from django.template.base import Template as DjangoTemplate
|
||||||
from django.template.context import Context
|
from django.template.context import Context
|
||||||
|
from django.utils.html import format_html
|
||||||
from django.utils.functional import lazy
|
from django.utils.functional import lazy
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
@@ -191,7 +192,7 @@ class Template(BaseModel):
|
|||||||
|
|
||||||
document_html = HTML(
|
document_html = HTML(
|
||||||
string=DjangoTemplate(self.code).render(
|
string=DjangoTemplate(self.code).render(
|
||||||
Context({"body": body_html, **metadata})
|
Context({"body": format_html(body_html), **metadata})
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
css = CSS(
|
css = CSS(
|
||||||
|
|||||||
Reference in New Issue
Block a user